fix bug when writing to a dotted field source when the last component doesnt yet exist on the related object

This commit is contained in:
Craig de Stigter 2013-08-29 17:29:22 +12:00
parent d5d97624f7
commit cc5096e6e6

View File

@ -69,7 +69,7 @@ def set_component(obj, attr_name, value):
if isinstance(obj, dict):
obj[attr_name] = value
else:
attr = getattr(obj, attr_name)
attr = getattr(obj, attr_name, None)
if six.callable(attr):
raise TypeError("%r.%s is a method; can't set it" % (obj, attr_name))
setattr(obj, attr_name, value)