Improved resolve_type function using partials

This commit is contained in:
Syrus Akbary 2015-11-03 21:41:06 -08:00
parent d13d7c0f68
commit 898329c240

View File

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