Fix bug with "private" attrs

I believe this is a bug but I'm not actually sure of the
desired intentions of underscore prefixed kwargs.

When you pass an underscore kwargs, this currently raises an
AttributeError because of the first conditional. The fix is to
swap these conditionals to allow for setting of underscore
attributes.
This commit is contained in:
Phil Aquilina 2017-08-03 12:33:19 -07:00
parent 557ec44a13
commit 1d6fbea1f4

View File

@ -107,7 +107,7 @@ class ObjectType(six.with_metaclass(ObjectTypeMeta)):
if kwargs:
for prop in list(kwargs):
try:
if isinstance(getattr(self.__class__, prop), property) or prop.startswith('_'):
if prop.startswith('_') or isinstance(getattr(self.__class__, prop), property):
setattr(self, prop, kwargs.pop(prop))
except AttributeError:
pass