Skip to content

fix: use execution_context_class attribute for GraphQLView #1398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions graphene_django/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ def __init__(
if middleware is None:
middleware = graphene_settings.MIDDLEWARE

self.schema = self.schema or schema
self.schema = schema or self.schema
if middleware is not None:
if isinstance(middleware, MiddlewareManager):
self.middleware = middleware
else:
self.middleware = list(instantiate_middleware(middleware))
self.root_value = root_value
self.pretty = self.pretty or pretty
self.graphiql = self.graphiql or graphiql
self.batch = self.batch or batch
self.execution_context_class = execution_context_class
self.pretty = pretty or self.pretty
self.graphiql = graphiql or self.graphiql
self.batch = batch or self.batch
self.execution_context_class = execution_context_class or self.execution_context_class
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probs want to follow the same pattern as the other attributes (graphiql, batch etc):

Suggested change
self.execution_context_class = execution_context_class or self.execution_context_class
self.execution_context_class = self.execution_context_class or execution_context_class

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so this is not a good pattern. class attribute it's something like default value. when we create an instance we need to have approach to redefine it. thats why i use current order.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Arfey Nice, thats a good point - could you update the other attributes to follow that pattern instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if subscription_path is None:
self.subscription_path = graphene_settings.SUBSCRIPTION_PATH

Expand Down