Skip to content

Simplified schema logic for the GraphQLView #15

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 1 commit into from
Nov 8, 2016
Merged
Changes from all 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
17 changes: 8 additions & 9 deletions flask_graphql/graphqlview.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ def __init__(self, **kwargs):
if hasattr(self, key):
setattr(self, key, value)

inner_schema = getattr(self.schema, 'schema', None)
if not self.executor:
self.executor = getattr(self.schema, 'executor', None)

if inner_schema:
self.schema = inner_schema

assert isinstance(self.schema, GraphQLSchema), 'A Schema is required to be provided to GraphQLView.'

# noinspection PyUnusedLocal
Expand All @@ -56,6 +49,12 @@ def get_root_value(self, request):
def get_context(self, request):
return request

def get_middleware(self, request):
return self.middleware

def get_executor(self, request):
return self.executor

def dispatch_request(self):
try:
if request.method.lower() not in ('get', 'post'):
Expand Down Expand Up @@ -181,8 +180,8 @@ def execute_graphql_request(self, data, query, variables, operation_name, show_g
variable_values=variables or {},
operation_name=operation_name,
context_value=self.get_context(request),
middleware=self.middleware,
executor=self.executor
middleware=self.get_middleware(request),
executor=self.get_executor(request)
)
except Exception as e:
return ExecutionResult(errors=[e], invalid=True)
Expand Down