Fixed issue with dynamic documents deltas

Closes #377
This commit is contained in:
Ross Lawley
2011-12-02 00:11:25 -08:00
parent 391f659af1
commit 071562d755
4 changed files with 13 additions and 1 deletions

View File

@@ -954,6 +954,7 @@ class BaseDocument(object):
set_fields = self._get_changed_fields()
set_data = {}
unset_data = {}
parts = []
if hasattr(self, '_changed_fields'):
set_data = {}
# Fetch each set item from its path
@@ -980,7 +981,7 @@ class BaseDocument(object):
# If we've set a value that ain't the default value dont unset it.
default = None
if self._dynamic and parts[0] in self._dynamic_fields:
if self._dynamic and len(parts) and parts[0] in self._dynamic_fields:
del(set_data[path])
unset_data[path] = 1
continue