Merge remote-tracking branch 'origin/pr/258'

Conflicts:
	AUTHORS
This commit is contained in:
Ross Lawley 2013-04-15 07:51:26 +00:00
commit 8f05896bc9

View File

@ -205,8 +205,12 @@ class BaseField(object):
def __set__(self, instance, value): def __set__(self, instance, value):
"""Descriptor for assigning a value to a field in a document. """Descriptor for assigning a value to a field in a document.
""" """
changed = False
if (self.name not in instance._data or
instance._data[self.name] != value):
changed = True
instance._data[self.name] = value instance._data[self.name] = value
if instance._initialised: if changed and instance._initialised:
instance._mark_as_changed(self.name) instance._mark_as_changed(self.name)
def error(self, message="", errors=None, field_name=None): def error(self, message="", errors=None, field_name=None):
@ -317,12 +321,6 @@ class ComplexBaseField(BaseField):
return value return value
def __set__(self, instance, value):
"""Descriptor for assigning a value to a field in a document.
"""
instance._data[self.name] = value
instance._mark_as_changed(self.name)
def to_python(self, value): def to_python(self, value):
"""Convert a MongoDB-compatible type to a Python type. """Convert a MongoDB-compatible type to a Python type.
""" """