Don't raise an exception if an object's attribute starts with an underscore,

just ignore it.
This commit is contained in:
sneakypete81 2013-10-29 08:30:38 +00:00
parent be7463518b
commit 1ba21353f9
2 changed files with 15 additions and 7 deletions

View file

@ -14,9 +14,8 @@ class TroveboxObject(object):
def _set_fields(self, json_dict):
""" Set this object's attributes specified in json_dict """
for key, value in json_dict.items():
if key.startswith("_"):
raise ValueError("Illegal attribute: %s" % key)
setattr(self, key, value)
if not key.startswith("_"):
setattr(self, key, value)
def _replace_fields(self, json_dict):
"""