This commit is contained in:
anih 2016-09-06 09:27:41 +02:00 committed by GitHub
parent 40e99b1b80
commit bd84667a2b

View File

@ -72,12 +72,12 @@ class BaseDocument(object):
# Check if there are undefined fields supplied to the constructor, # Check if there are undefined fields supplied to the constructor,
# if so raise an Exception. # if so raise an Exception.
if not self._dynamic and (self._meta.get('strict', True) or _created): if not self._dynamic and (self._meta.get('strict', True) or _created):
_missing_fields_keys = set(values.keys()) - set( _undefined_fields = set(values.keys()) - set(
self._fields.keys() + ['id', 'pk', '_cls', '_text_score']) self._fields.keys() + ['id', 'pk', '_cls', '_text_score'])
if _missing_fields_keys: if _undefined_fields:
msg = ( msg = (
"The fields '{0}' does not exist on the document '{1}'" "The fields '{0}' do not exist on the document '{1}'"
).format(_missing_fields_keys, self._class_name) ).format(_undefined_fields, self._class_name)
raise FieldDoesNotExist(msg) raise FieldDoesNotExist(msg)
if self.STRICT and not self._dynamic: if self.STRICT and not self._dynamic: