From fdb30322a01168a0f0773a4d2b9270cf4bfd1849 Mon Sep 17 00:00:00 2001 From: femesq Date: Thu, 16 Mar 2017 12:43:11 -0300 Subject: [PATCH 1/2] Accept custom middleware on experimental executor Other option would be making middleware verification that happens on #L47[https://github.com/graphql-python/graphql-core/blob/features/next-query-builder/graphql/execution/executor.py#L47] before calling the experimental executor on #L36[https://github.com/graphql-python/graphql-core/blob/features/next-query-builder/graphql/execution/executor.py#L36] --- graphql/execution/experimental/executor.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/graphql/execution/experimental/executor.py b/graphql/execution/experimental/executor.py index ad14925c..1a60b39d 100644 --- a/graphql/execution/experimental/executor.py +++ b/graphql/execution/experimental/executor.py @@ -16,6 +16,9 @@ def execute(schema, document_ast, root_value=None, context_value=None, 'not multiple versions of GraphQL installed in your node_modules directory.' ) if middleware: + if not isinstance(middleware, MiddlewareManager): + middleware = MiddlewareManager(*middleware) + assert isinstance(middleware, MiddlewareManager), ( 'middlewares have to be an instance' ' of MiddlewareManager. Received "{}".'.format(middleware) From 6ec9b66d9cf42e1292675a9996843616ae9b07aa Mon Sep 17 00:00:00 2001 From: femesq Date: Thu, 16 Mar 2017 18:19:25 -0300 Subject: [PATCH 2/2] Update executor.py --- graphql/execution/experimental/executor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/graphql/execution/experimental/executor.py b/graphql/execution/experimental/executor.py index 1a60b39d..401fbfa8 100644 --- a/graphql/execution/experimental/executor.py +++ b/graphql/execution/experimental/executor.py @@ -18,7 +18,6 @@ def execute(schema, document_ast, root_value=None, context_value=None, if middleware: if not isinstance(middleware, MiddlewareManager): middleware = MiddlewareManager(*middleware) - assert isinstance(middleware, MiddlewareManager), ( 'middlewares have to be an instance' ' of MiddlewareManager. Received "{}".'.format(middleware)