Fix ndict woes.

This commit is contained in:
Stephen Diehl
2012-05-14 13:49:45 -04:00
parent d0d48ab7df
commit d399edd419
5 changed files with 14 additions and 5 deletions
+7 -1
View File
@@ -50,6 +50,13 @@ class ndict(MutableMapping):
# Abstact Overloads
# -----------------
def __setattr__(self, key, value):
if 'ndict' in key or key == 'cls':
MutableMapping.__setattr__(self, key, value)
else:
self.__internal[key] = value
return value
def __setitem__(self, key, value):
"""
Required for use by pymongo as_class parameter to find.
@@ -59,7 +66,6 @@ class ndict(MutableMapping):
else:
self.__internal[key] = value
def __getattr__(self, key):
if key in self.cls:
return self.__dict__[key]