Simplified ConnectionField type checking

This commit is contained in:
Syrus Akbary 2016-11-03 00:17:30 -07:00
parent 072b2f3dd0
commit 1d8f5ded33

View File

@ -119,20 +119,15 @@ class ConnectionField(Field):
kwargs.setdefault('after', String())
kwargs.setdefault('first', Int())
kwargs.setdefault('last', Int())
assert issubclass(type, Connection), (
'{} type have to be a subclass of Connection. Received "{}".'
).format(str(self), type)
super(ConnectionField, self).__init__(
type,
*args,
**kwargs
)
@property
def type(self):
type = super(ConnectionField, self).type
assert issubclass(type, Connection), (
'{} type have to be a subclass of Connection. Received "{}".'
).format(str(self), type)
return type
@classmethod
def connection_resolver(cls, resolver, connection_type, root, args, context, info):
resolved = resolver(root, args, context, info)