Removed "elif field.default" block to avoid silently, inconsistently changing database

This resolved issue Please recall fix on: Saving document doesn't create new fields in existing collection #620 #1126
This commit is contained in:
Gang Li 2015-10-12 23:33:54 -04:00
parent 5bbfca45fa
commit eb8176971c

View File

@ -712,14 +712,6 @@ class BaseDocument(object):
del data[field.db_field] del data[field.db_field]
except (AttributeError, ValueError), e: except (AttributeError, ValueError), e:
errors_dict[field_name] = e errors_dict[field_name] = e
elif field.default:
default = field.default
if callable(default):
default = default()
if isinstance(default, BaseDocument):
changed_fields.append(field_name)
elif not only_fields or field_name in only_fields:
changed_fields.append(field_name)
if errors_dict: if errors_dict:
errors = "\n".join(["%s - %s" % (k, v) errors = "\n".join(["%s - %s" % (k, v)