diff --git a/graphene_django/debug/tests/test_query.py b/graphene_django/debug/tests/test_query.py index 87e9628..e0851e7 100644 --- a/graphene_django/debug/tests/test_query.py +++ b/graphene_django/debug/tests/test_query.py @@ -59,8 +59,8 @@ def test_should_query_field(): }] } } - schema = graphene.Schema(query=Query, middlewares=[DjangoDebugMiddleware()]) - result = schema.execute(query, context_value=context()) + schema = graphene.Schema(query=Query) + result = schema.execute(query, context_value=context(), middleware=[DjangoDebugMiddleware()]) assert not result.errors assert result.data == expected @@ -108,8 +108,8 @@ def test_should_query_list(): }] } } - schema = graphene.Schema(query=Query, middlewares=[DjangoDebugMiddleware()]) - result = schema.execute(query, context_value=context()) + schema = graphene.Schema(query=Query) + result = schema.execute(query, context_value=context(), middleware=[DjangoDebugMiddleware()]) assert not result.errors assert result.data == expected @@ -158,8 +158,8 @@ def test_should_query_connection(): }] }, } - schema = graphene.Schema(query=Query, middlewares=[DjangoDebugMiddleware()]) - result = schema.execute(query, context_value=context()) + schema = graphene.Schema(query=Query) + result = schema.execute(query, context_value=context(), middleware=[DjangoDebugMiddleware()]) assert not result.errors assert result.data['allReporters'] == expected['allReporters'] assert 'COUNT' in result.data['__debug']['sql'][0]['rawSql'] @@ -216,8 +216,8 @@ def test_should_query_connectionfilter(): }] }, } - schema = graphene.Schema(query=Query, middlewares=[DjangoDebugMiddleware()]) - result = schema.execute(query, context_value=context()) + schema = graphene.Schema(query=Query) + result = schema.execute(query, context_value=context(), middleware=[DjangoDebugMiddleware()]) assert not result.errors assert result.data['allReporters'] == expected['allReporters'] assert 'COUNT' in result.data['__debug']['sql'][0]['rawSql'] diff --git a/graphene_django/views.py b/graphene_django/views.py index 27a27df..cec3aab 100644 --- a/graphene_django/views.py +++ b/graphene_django/views.py @@ -14,7 +14,6 @@ from graphql import Source, execute, parse, validate from graphql.error import format_error as format_graphql_error from graphql.error import GraphQLError from graphql.execution import ExecutionResult -from graphql.execution.middleware import MiddlewareManager from graphql.type.schema import GraphQLSchema from graphql.utils.get_operation_ast import get_operation_ast @@ -73,7 +72,7 @@ class GraphQLView(View): self.schema = schema if middleware is not None: - self.middleware = MiddlewareManager(*list(instantiate_middleware(middleware))) + self.middleware = list(instantiate_middleware(middleware)) self.executor = executor self.root_value = root_value self.pretty = pretty @@ -220,7 +219,7 @@ class GraphQLView(View): variable_values=variables, operation_name=operation_name, context_value=self.get_context(request), - middlewares=self.get_middleware(request), + middleware=self.get_middleware(request), executor=self.executor, ) except Exception as e: