mirror of
https://github.com/graphql-python/graphene.git
synced 2025-09-21 19:32:33 +03:00
Remove func wrapper used in debugging get_resolver partial
This commit is contained in:
parent
68cdddd0b0
commit
ce48acb710
|
@ -1,4 +1,3 @@
|
||||||
from collections import OrderedDict
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from inspect import isclass
|
from inspect import isclass
|
||||||
|
|
||||||
|
@ -62,14 +61,7 @@ class NodeField(Field):
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_resolver(self, parent_resolver):
|
def get_resolver(self, parent_resolver):
|
||||||
def return_partial(*args, **kwargs):
|
return partial(self.node_type.node_resolver, get_type(self.field_type))
|
||||||
print("\n\nDebugging get_resolver: ")
|
|
||||||
print(parent_resolver, args, kwargs)
|
|
||||||
return partial(self.node_type.node_resolver, get_type(self.field_type))(
|
|
||||||
*args, **kwargs
|
|
||||||
)
|
|
||||||
|
|
||||||
return return_partial
|
|
||||||
|
|
||||||
|
|
||||||
class AbstractNode(Interface):
|
class AbstractNode(Interface):
|
||||||
|
@ -79,9 +71,7 @@ class AbstractNode(Interface):
|
||||||
@classmethod
|
@classmethod
|
||||||
def __init_subclass_with_meta__(cls, **options):
|
def __init_subclass_with_meta__(cls, **options):
|
||||||
_meta = InterfaceOptions(cls)
|
_meta = InterfaceOptions(cls)
|
||||||
_meta.fields = OrderedDict(
|
_meta.fields = {"id": GlobalID(cls, description="The ID of the object")}
|
||||||
id=GlobalID(cls, description="The ID of the object.")
|
|
||||||
)
|
|
||||||
super(AbstractNode, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
super(AbstractNode, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,8 +92,11 @@ class Node(AbstractNode):
|
||||||
_type, _id = cls.from_global_id(global_id)
|
_type, _id = cls.from_global_id(global_id)
|
||||||
graphene_type = info.schema.get_type(_type).graphene_type
|
graphene_type = info.schema.get_type(_type).graphene_type
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
raise Exception(
|
||||||
raise
|
"Unable call from_global_id, is the id base64 encoding of 'TypeName:id': {} Exception: {}".format(
|
||||||
|
str(global_id), str(e)
|
||||||
|
)
|
||||||
|
)
|
||||||
if only_type:
|
if only_type:
|
||||||
assert graphene_type == only_type, ("Must receive a {} id.").format(
|
assert graphene_type == only_type, ("Must receive a {} id.").format(
|
||||||
only_type._meta.name
|
only_type._meta.name
|
||||||
|
|
Loading…
Reference in New Issue
Block a user