Remove func wrapper used in debugging get_resolver partial

This commit is contained in:
James 2019-09-26 13:28:40 -05:00 committed by Jonathan Kim
parent 68cdddd0b0
commit ce48acb710

View File

@ -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