Skip to content

Commit 3fa65aa

Browse files
committed
Improved connection type of checking
1 parent 42b93b5 commit 3fa65aa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

graphene/relay/connection.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ class Connection(six.with_metaclass(ConnectionMeta, ObjectType)):
9595
def Field(cls, *args, **kwargs): # noqa: N802
9696
return ConnectionField(cls, *args, **kwargs)
9797

98+
@classmethod
99+
def is_type_of(cls, root, context, info):
100+
return isinstance(root, cls)
101+
98102
@classmethod
99103
def connection_resolver(cls, resolved, args, context, info):
100104
assert isinstance(resolved, Iterable), (
@@ -132,7 +136,7 @@ def __init__(self, type, *args, **kwargs):
132136
def connection_resolver(cls, resolver, connection_type, root, args, context, info):
133137
resolved = resolver(root, args, context, info)
134138

135-
if isinstance(resolved, connection_type):
139+
if connection_type.is_type_of(resolved, context, info):
136140
return resolved
137141

138142
on_resolve = partial(connection_type.connection_resolver, args=args, context=context, info=info)

0 commit comments

Comments
 (0)