From 1d6fbea1f4d96df1c5d6b92ff24b28016d606175 Mon Sep 17 00:00:00 2001 From: Phil Aquilina Date: Thu, 3 Aug 2017 12:33:19 -0700 Subject: [PATCH] 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. --- graphene/types/objecttype.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphene/types/objecttype.py b/graphene/types/objecttype.py index 1f0e5b8d..d04b3b88 100644 --- a/graphene/types/objecttype.py +++ b/graphene/types/objecttype.py @@ -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