support deepcopy on bson.SON

This commit is contained in:
Mathias Stearn 2010-11-10 10:58:05 -05:00
parent 7269ec4c9b
commit 09f72e6029

View File

@ -18,6 +18,7 @@ Regular dictionaries can be used instead of SON objects, but not when the order
of keys is important. A SON object can be used just like a normal Python
dictionary."""
import copy
class SON(dict):
"""SON data.
@ -202,3 +203,9 @@ class SON(dict):
return value
return transform_value(dict(self))
def __deepcopy__(self, memo):
out = SON()
for k, v in self.iteritems():
out[k] = copy.deepcopy(v, memo)
return out