Add backwards compat for pickle
This commit is contained in:
parent
6299015039
commit
56cd73823e
@ -148,9 +148,10 @@ class BaseDocument(object):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def __setstate__(self, data):
|
def __setstate__(self, data):
|
||||||
for k in ('_changed_fields', '_initialised', '_created'):
|
if isinstance(data["_data"], SON):
|
||||||
|
data["_data"] = self.__class__._from_son(data["_data"])._data
|
||||||
|
for k in ('_changed_fields', '_initialised', '_created', '_data'):
|
||||||
setattr(self, k, data[k])
|
setattr(self, k, data[k])
|
||||||
self._data = self.__class__._from_son(data["_data"])._data
|
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
if 'id' in self._fields and 'id' not in self._fields_ordered:
|
if 'id' in self._fields and 'id' not in self._fields_ordered:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user