Move NonNull check

This commit is contained in:
Jonathan Kim 2018-02-17 21:50:40 +00:00
parent 38baf7ab52
commit c25bcb3345

View File

@ -115,9 +115,6 @@ class IterableConnectionField(Field):
@classmethod
def resolve_connection(cls, connection_type, args, resolved):
if isinstance(connection_type, NonNull):
connection_type = connection_type.of_type
if isinstance(resolved, connection_type):
return resolved
@ -139,6 +136,9 @@ class IterableConnectionField(Field):
def connection_resolver(cls, resolver, connection_type, root, info, **args):
resolved = resolver(root, info, **args)
if isinstance(connection_type, NonNull):
connection_type = connection_type.of_type
on_resolve = partial(cls.resolve_connection, connection_type, args)
if is_thenable(resolved):
return Promise.resolve(resolved).then(on_resolve)