mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-23 01:56:54 +03:00
Improved resolve_type function using partials
This commit is contained in:
parent
d13d7c0f68
commit
898329c240
|
@ -1,6 +1,7 @@
|
||||||
import copy
|
import copy
|
||||||
import inspect
|
import inspect
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
@ -192,8 +193,7 @@ class BaseObjectType(object):
|
||||||
return GraphQLInterfaceType(
|
return GraphQLInterfaceType(
|
||||||
cls._meta.type_name,
|
cls._meta.type_name,
|
||||||
description=cls._meta.description,
|
description=cls._meta.description,
|
||||||
resolve_type=lambda *
|
resolve_type=partial(cls.resolve_type, schema),
|
||||||
args, **kwargs: cls.resolve_type(schema, *args, **kwargs),
|
|
||||||
fields=fields
|
fields=fields
|
||||||
)
|
)
|
||||||
return GraphQLObjectType(
|
return GraphQLObjectType(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user