Skip to content

Commit

Permalink
Merge pull request #39 from juyrjola/master
Browse files Browse the repository at this point in the history
Fix compatibility with newer django-graphene
  • Loading branch information
maarcingebala authored Feb 25, 2020
2 parents c72e88a + 9e52d3e commit 683caeb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dev-env-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r requirements.txt
graphene==2.1.3
graphene-django==2.2.0
graphene==2.1.8
graphene-django==2.7.1
pytest==4.6.3
pytest-django==3.5.0
pytest-cov==2.7.1
Expand Down
10 changes: 9 additions & 1 deletion graphene_django_optimizer/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,15 @@ def _get_name_from_resolver(self, resolver):
elif isinstance(resolver, functools.partial):
resolver_fn = 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:
return resolver_fn.args[0]
return resolver_fn
Expand Down

0 comments on commit 683caeb

Please sign in to comment.