fix: use execution_context_class attribute for GraphQLView (#1398)

* fix: use execution_context_class attribute for GraphQLView
This commit is contained in:
Mykhailo Havelia 2023-05-24 15:54:44 +03:00 committed by GitHub
parent 72a3700856
commit 388ca41d64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,17 +105,19 @@ class GraphQLView(View):
if middleware is None: if middleware is None:
middleware = graphene_settings.MIDDLEWARE middleware = graphene_settings.MIDDLEWARE
self.schema = self.schema or schema self.schema = schema or self.schema
if middleware is not None: if middleware is not None:
if isinstance(middleware, MiddlewareManager): if isinstance(middleware, MiddlewareManager):
self.middleware = middleware self.middleware = middleware
else: else:
self.middleware = list(instantiate_middleware(middleware)) self.middleware = list(instantiate_middleware(middleware))
self.root_value = root_value self.root_value = root_value
self.pretty = self.pretty or pretty self.pretty = pretty or self.pretty
self.graphiql = self.graphiql or graphiql self.graphiql = graphiql or self.graphiql
self.batch = self.batch or batch self.batch = batch or self.batch
self.execution_context_class = execution_context_class self.execution_context_class = (
execution_context_class or self.execution_context_class
)
if subscription_path is None: if subscription_path is None:
self.subscription_path = graphene_settings.SUBSCRIPTION_PATH self.subscription_path = graphene_settings.SUBSCRIPTION_PATH