Skip to content
Snippets Groups Projects
Unverified Commit 683caebb authored by Marcin Gębala's avatar Marcin Gębala Committed by GitHub
Browse files

Merge pull request #39 from juyrjola/master

Fix compatibility with newer django-graphene
parents c72e88a1 9e52d3e0
No related branches found
No related tags found
No related merge requests found
-r requirements.txt -r requirements.txt
graphene==2.1.3 graphene==2.1.8
graphene-django==2.2.0 graphene-django==2.7.1
pytest==4.6.3 pytest==4.6.3
pytest-django==3.5.0 pytest-django==3.5.0
pytest-cov==2.7.1 pytest-cov==2.7.1
......
...@@ -271,7 +271,15 @@ class QueryOptimizer(object): ...@@ -271,7 +271,15 @@ class QueryOptimizer(object):
elif isinstance(resolver, functools.partial): elif isinstance(resolver, functools.partial):
resolver_fn = resolver resolver_fn = resolver
if resolver_fn.func != default_resolver: if resolver_fn.func != default_resolver:
resolver_fn = resolver_fn.args[0] # Some resolvers have the partial function as the second
# argument.
for arg in resolver_fn.args:
if isinstance(arg, (str, functools.partial)):
break
else:
# No suitable instances found, default to first arg
arg = resolver_fn.args[0]
resolver_fn = arg
if isinstance(resolver_fn, functools.partial) and resolver_fn.func == default_resolver: if isinstance(resolver_fn, functools.partial) and resolver_fn.func == default_resolver:
return resolver_fn.args[0] return resolver_fn.args[0]
return resolver_fn return resolver_fn
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment