Ensure meta.strict does not bypass constructor check

This commit is contained in:
Axel Haustant
2015-04-13 18:48:42 +02:00
parent 2bfb195ad6
commit ddbcc8e84b
2 changed files with 18 additions and 3 deletions

View File

@@ -70,9 +70,9 @@ class BaseDocument(object):
signals.pre_init.send(self.__class__, document=self, values=values)
# Check if there are undefined fields supplied, if so raise an
# Exception.
if not self._dynamic and self._meta.get('strict', True):
# Check if there are undefined fields supplied to the constructor,
# if so raise an Exception.
if not self._dynamic and (self._meta.get('strict', True) or _created):
for var in values.keys():
if var not in self._fields.keys() + ['id', 'pk', '_cls', '_text_score']:
msg = (