Fixed pickle unsaved document regression (#327)

This commit is contained in:
Ross Lawley
2013-05-21 07:07:17 +00:00
parent fd11244966
commit 9aa77bb3c9
2 changed files with 6 additions and 1 deletions

View File

@@ -143,7 +143,8 @@ class BaseDocument(object):
def __getstate__(self):
data = {}
for k in ('_changed_fields', '_initialised', '_created'):
data[k] = getattr(self, k)
if hasattr(self, k):
data[k] = getattr(self, k)
data['_data'] = self.to_mongo()
return data