Document dict access now only looks for fields

This commit is contained in:
Harry Marr 2010-01-05 19:37:30 +00:00
parent af1d7ef664
commit 4ae21a671d

View File

@ -202,8 +202,10 @@ class BaseDocument(object):
"""Dictionary-style field access, return a field's value if present. """Dictionary-style field access, return a field's value if present.
""" """
try: try:
if name in self._fields:
return getattr(self, name) return getattr(self, name)
except AttributeError: except AttributeError:
pass
raise KeyError(name) raise KeyError(name)
def __setitem__(self, name, value): def __setitem__(self, name, value):