Merge remote-tracking branch 'origin/pr/349' into 349

This commit is contained in:
Ross Lawley
2013-06-06 12:06:23 +00:00
2 changed files with 19 additions and 0 deletions

View File

@@ -82,6 +82,12 @@ class BaseField(object):
def __set__(self, instance, value):
"""Descriptor for assigning a value to a field in a document.
"""
if value is None:
value = self.default
# Allow callable default values
if callable(value):
value = value()
if instance._initialised:
try:
if (self.name not in instance._data or