mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-26 03:24:07 +03:00
GraphQlView: Do not 'instantiate_middleware' if middleware is already a MiddlewareManager (#952)
This commit is contained in:
parent
894c564ab7
commit
975f45ed1a
|
@ -15,6 +15,7 @@ from graphql.error import format_error as format_graphql_error
|
||||||
from graphql.error import GraphQLError
|
from graphql.error import GraphQLError
|
||||||
from graphql.execution import ExecutionResult
|
from graphql.execution import ExecutionResult
|
||||||
from graphql.type.schema import GraphQLSchema
|
from graphql.type.schema import GraphQLSchema
|
||||||
|
from graphql.execution.middleware import MiddlewareManager
|
||||||
|
|
||||||
from .settings import graphene_settings
|
from .settings import graphene_settings
|
||||||
|
|
||||||
|
@ -86,6 +87,9 @@ class GraphQLView(View):
|
||||||
|
|
||||||
self.schema = self.schema or schema
|
self.schema = self.schema or schema
|
||||||
if middleware is not None:
|
if middleware is not None:
|
||||||
|
if isinstance(middleware, MiddlewareManager):
|
||||||
|
self.middleware = middleware
|
||||||
|
else:
|
||||||
self.middleware = list(instantiate_middleware(middleware))
|
self.middleware = list(instantiate_middleware(middleware))
|
||||||
self.executor = executor
|
self.executor = executor
|
||||||
self.root_value = root_value
|
self.root_value = root_value
|
||||||
|
|
Loading…
Reference in New Issue
Block a user