mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-12 00:52:22 +03:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6f76882397 | ||
|
4775755e48 | ||
|
48507b9a0f |
|
@ -4,7 +4,6 @@ python:
|
||||||
- 2.7
|
- 2.7
|
||||||
- 3.4
|
- 3.4
|
||||||
- 3.5
|
- 3.5
|
||||||
- pypy
|
|
||||||
before_install:
|
before_install:
|
||||||
- |
|
- |
|
||||||
if [ "$TRAVIS_PYTHON_VERSION" = "pypy" ]; then
|
if [ "$TRAVIS_PYTHON_VERSION" = "pypy" ]; then
|
||||||
|
|
|
@ -10,7 +10,7 @@ except NameError:
|
||||||
__SETUP__ = False
|
__SETUP__ = False
|
||||||
|
|
||||||
|
|
||||||
VERSION = (1, 4, 1, 'final', 0)
|
VERSION = (1, 4, 2, 'final', 0)
|
||||||
|
|
||||||
__version__ = get_version(VERSION)
|
__version__ = get_version(VERSION)
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,8 @@ class ClientIDMutationMeta(ObjectTypeMeta):
|
||||||
base_name = re.sub('Payload$', '', name)
|
base_name = re.sub('Payload$', '', name)
|
||||||
if 'client_mutation_id' not in attrs:
|
if 'client_mutation_id' not in attrs:
|
||||||
attrs['client_mutation_id'] = String(name='clientMutationId')
|
attrs['client_mutation_id'] = String(name='clientMutationId')
|
||||||
cls = ObjectTypeMeta.__new__(cls, '{}Payload'.format(base_name), bases, attrs)
|
cls = ObjectTypeMeta.__new__(
|
||||||
|
cls, '{}Payload'.format(base_name), bases, attrs)
|
||||||
mutate_and_get_payload = getattr(cls, 'mutate_and_get_payload', None)
|
mutate_and_get_payload = getattr(cls, 'mutate_and_get_payload', None)
|
||||||
if cls.mutate and cls.mutate.__func__ == ClientIDMutation.mutate.__func__:
|
if cls.mutate and cls.mutate.__func__ == ClientIDMutation.mutate.__func__:
|
||||||
assert mutate_and_get_payload, (
|
assert mutate_and_get_payload, (
|
||||||
|
@ -39,8 +40,10 @@ class ClientIDMutationMeta(ObjectTypeMeta):
|
||||||
else:
|
else:
|
||||||
bases += (input_class, )
|
bases += (input_class, )
|
||||||
input_attrs['client_mutation_id'] = String(name='clientMutationId')
|
input_attrs['client_mutation_id'] = String(name='clientMutationId')
|
||||||
cls.Input = type('{}Input'.format(base_name), bases + (InputObjectType,), input_attrs)
|
cls.Input = type('{}Input'.format(base_name), bases +
|
||||||
cls.Field = partial(Field, cls, resolver=cls.mutate, input=Argument(cls.Input, required=True))
|
(InputObjectType,), input_attrs)
|
||||||
|
cls.Field = partial(Field, cls, resolver=cls.mutate,
|
||||||
|
input=Argument(cls.Input, required=True))
|
||||||
return cls
|
return cls
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +56,7 @@ class ClientIDMutation(six.with_metaclass(ClientIDMutationMeta, ObjectType)):
|
||||||
def on_resolve(payload):
|
def on_resolve(payload):
|
||||||
try:
|
try:
|
||||||
payload.client_mutation_id = input.get('clientMutationId')
|
payload.client_mutation_id = input.get('clientMutationId')
|
||||||
except:
|
except Exception:
|
||||||
raise Exception((
|
raise Exception((
|
||||||
'Cannot set client_mutation_id in the payload object {}'
|
'Cannot set client_mutation_id in the payload object {}'
|
||||||
).format(repr(payload)))
|
).format(repr(payload)))
|
||||||
|
|
|
@ -55,7 +55,8 @@ class NodeMeta(InterfaceMeta):
|
||||||
|
|
||||||
def __new__(cls, name, bases, attrs):
|
def __new__(cls, name, bases, attrs):
|
||||||
cls = InterfaceMeta.__new__(cls, name, bases, attrs)
|
cls = InterfaceMeta.__new__(cls, name, bases, attrs)
|
||||||
cls._meta.fields['id'] = GlobalID(cls, description='The ID of the object.')
|
cls._meta.fields['id'] = GlobalID(
|
||||||
|
cls, description='The ID of the object.')
|
||||||
return cls
|
return cls
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,7 +69,8 @@ class NodeField(Field):
|
||||||
self.field_type = type
|
self.field_type = type
|
||||||
|
|
||||||
super(NodeField, self).__init__(
|
super(NodeField, self).__init__(
|
||||||
# If we don's specify a type, the field type will be the node interface
|
# If we don's specify a type, the field type will be the node
|
||||||
|
# interface
|
||||||
type or node,
|
type or node,
|
||||||
description='The ID of the object',
|
description='The ID of the object',
|
||||||
id=ID(required=True)
|
id=ID(required=True)
|
||||||
|
@ -94,7 +96,7 @@ class Node(six.with_metaclass(NodeMeta, Interface)):
|
||||||
try:
|
try:
|
||||||
_type, _id = cls.from_global_id(global_id)
|
_type, _id = cls.from_global_id(global_id)
|
||||||
graphene_type = info.schema.get_type(_type).graphene_type
|
graphene_type = info.schema.get_type(_type).graphene_type
|
||||||
except:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if only_type:
|
if only_type:
|
||||||
|
|
|
@ -8,7 +8,7 @@ from .scalars import Scalar
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import iso8601
|
import iso8601
|
||||||
except:
|
except ImportError:
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"iso8601 package is required for DateTime Scalar.\n"
|
"iso8601 package is required for DateTime Scalar.\n"
|
||||||
"You can install it using: pip install iso8601."
|
"You can install it using: pip install iso8601."
|
||||||
|
|
9
setup.py
9
setup.py
|
@ -37,6 +37,7 @@ class PyTest(TestCommand):
|
||||||
errno = pytest.main(self.pytest_args)
|
errno = pytest.main(self.pytest_args)
|
||||||
sys.exit(errno)
|
sys.exit(errno)
|
||||||
|
|
||||||
|
|
||||||
tests_require = [
|
tests_require = [
|
||||||
'pytest>=2.7.2',
|
'pytest>=2.7.2',
|
||||||
'pytest-benchmark',
|
'pytest-benchmark',
|
||||||
|
@ -81,10 +82,10 @@ setup(
|
||||||
packages=find_packages(exclude=['tests']),
|
packages=find_packages(exclude=['tests']),
|
||||||
|
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'six>=1.10.0',
|
'six>=1.10.0,<2',
|
||||||
'graphql-core>=1.1',
|
'graphql-core>=1.1,<2',
|
||||||
'graphql-relay>=0.4.5',
|
'graphql-relay>=0.4.5,<1',
|
||||||
'promise>=2.0',
|
'promise>=2.0,<2.1',
|
||||||
],
|
],
|
||||||
tests_require=tests_require,
|
tests_require=tests_require,
|
||||||
extras_require={
|
extras_require={
|
||||||
|
|
Loading…
Reference in New Issue
Block a user