Document dict access now only looks for fields
This commit is contained in:
parent
af1d7ef664
commit
4ae21a671d
1 changed files with 4 additions and 2 deletions
|
|
@ -202,9 +202,11 @@ 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:
|
||||||
return getattr(self, name)
|
if name in self._fields:
|
||||||
|
return getattr(self, name)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise KeyError(name)
|
pass
|
||||||
|
raise KeyError(name)
|
||||||
|
|
||||||
def __setitem__(self, name, value):
|
def __setitem__(self, name, value):
|
||||||
"""Dictionary-style field access, set a field's value.
|
"""Dictionary-style field access, set a field's value.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue