Skip to content

Commit

Permalink
Add ability to pass execution_context_class to GraphQLView.as_view()
Browse files Browse the repository at this point in the history
Currently when passing `execution_context_class` like this:

```
GraphQLView.as_view(execution_context_class=CustomContext)
```

you get the following error from `View.as_view()`
```
TypeError: GraphQLView() received an invalid keyword 'execution_context_class'. as_view only accepts arguments that are already attributes of the class.
```

this PR fixes the `hasattr` check in `.as_view`.

Fixes: graphql-python#1072
  • Loading branch information
kubami committed Feb 3, 2021
1 parent c3404a9 commit 30fa860
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion graphene_django/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ class GraphQLView(View):
pretty = False
batch = False
subscription_path = None

execution_context_class = None

def __init__(
self,
schema=None,
Expand Down

0 comments on commit 30fa860

Please sign in to comment.