Updated to work with the last version of graphql-core supporting field ordering

This commit is contained in:
Syrus Akbary 2015-10-10 17:23:40 -07:00
parent bad3dd4a4e
commit 2b6a253b78
2 changed files with 6 additions and 30 deletions

View File

@ -1,17 +1,12 @@
from functools import wraps
from collections import OrderedDict
from graphql.core import graphql
from graphql.core.type import (
GraphQLSchema as _GraphQLSchema
)
from graphql.core.execution.executor import Executor
from graphql.core.execution.middlewares.sync import SynchronousExecutionMiddleware
from graphql.core.execution import ExecutionResult, execute
from graphql.core.language.parser import parse
from graphql.core.language.source import Source
from graphql.core.validation import validate
from graphql.core.utils.introspection_query import introspection_query
from graphene import signals
@ -51,9 +46,7 @@ class Schema(object):
@property
def executor(self):
if not self._executor:
# TODO: Update to map_type=OrderedDict when graphql-core
# update its package in pypi
self.executor = Executor([SynchronousExecutionMiddleware()])
self.executor = Executor([SynchronousExecutionMiddleware()], map_type=OrderedDict)
return self._executor
@executor.setter
@ -84,30 +77,13 @@ class Schema(object):
def execute(self, request='', root=None, vars=None, operation_name=None):
root = root or object()
return graphql(
return self.executor.execute(
self.schema,
request,
root=self.query(root),
vars=vars,
operation_name=operation_name
args=vars,
operation_name=operation_name,
)
# source = Source(request, 'GraphQL request')
# ast = parse(source)
# validation_errors = validate(self.schema, ast)
# if validation_errors:
# return ExecutionResult(
# errors=validation_errors,
# invalid=True,
# )
# return self.executor.execute(
# self.schema,
# ast,
# root=self.query(root),
# args=vars,
# operation_name=operation_name,
# validate_ast=False
# )
def introspect(self):
return self.execute(introspection_query).data

View File

@ -24,7 +24,7 @@ class PyTest(TestCommand):
setup(
name='graphene',
version='0.1.4',
version='0.1.5',
description='Graphene: Python DSL for GraphQL',
long_description=open('README.rst').read(),
@ -56,7 +56,7 @@ setup(
install_requires=[
'six>=1.10.0',
'blinker',
'graphql-core==0.1a2',
'graphql-core==0.1a3',
'graphql-relay==0.2.0'
],
tests_require=[