mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-04 12:23:12 +03:00
Fix dict pop issue.
This commit is contained in:
parent
6512002623
commit
8c81257024
|
@ -54,12 +54,7 @@ class ObjectType(six.with_metaclass(ObjectTypeMeta, FieldsClassType)):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
signals.pre_init.send(self.__class__, args=args, kwargs=kwargs)
|
signals.pre_init.send(self.__class__, args=args, kwargs=kwargs)
|
||||||
|
|
||||||
self._root = kwargs.pop('_root', None)
|
self._root = kwargs.pop('_root', None)
|
||||||
for key, value in kwargs.items():
|
|
||||||
if key.startswith('_'):
|
|
||||||
setattr(self, key, kwargs.pop(key))
|
|
||||||
|
|
||||||
args_len = len(args)
|
args_len = len(args)
|
||||||
fields = self._meta.fields
|
fields = self._meta.fields
|
||||||
if args_len > len(fields):
|
if args_len > len(fields):
|
||||||
|
@ -85,7 +80,7 @@ class ObjectType(six.with_metaclass(ObjectTypeMeta, FieldsClassType)):
|
||||||
if kwargs:
|
if kwargs:
|
||||||
for prop in list(kwargs):
|
for prop in list(kwargs):
|
||||||
try:
|
try:
|
||||||
if isinstance(getattr(self.__class__, prop), property):
|
if isinstance(getattr(self.__class__, prop), property) or prop.startswith('_'):
|
||||||
setattr(self, prop, kwargs.pop(prop))
|
setattr(self, prop, kwargs.pop(prop))
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user