Skip to content

Commit b377eb6

Browse files
committed
Fixed Python3 errors
1 parent bc3d176 commit b377eb6

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

graphene/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
GraphQLID as ID
77
)
88

9-
from graphene import signals
9+
# from graphene import signals
1010

1111
from graphene.core.schema import (
1212
Schema

graphene/core/types.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,22 @@ def __new__(cls, name, bases, attrs):
5353

5454
assert not (new_class._meta.interface and new_class._meta.mutation)
5555

56+
input_class = None
57+
if new_class._meta.mutation:
58+
input_class = attrs.pop('Input', None)
59+
5660
# Add all attributes to the class.
5761
for obj_name, obj in attrs.items():
5862
new_class.add_to_class(obj_name, obj)
5963

6064
if new_class._meta.mutation:
6165
assert hasattr(new_class, 'mutate'), "All mutations must implement mutate method"
62-
Input = getattr(new_class, 'Input', None)
63-
if Input:
64-
input_type = type('{}Input'.format(new_class._meta.type_name), (Input, ObjectType), Input.__dict__)
65-
setattr(new_class, 'input_type', input_type)
66+
67+
if input_class:
68+
items = dict(input_class.__dict__)
69+
items.pop('__dict__', None)
70+
input_type = type('{}Input'.format(new_class._meta.type_name), (ObjectType, ), items)
71+
new_class.add_to_class('input_type', input_type)
6672

6773
new_class.add_extra_fields()
6874

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ deps=
1414
setenv =
1515
PYTHONPATH = .:{envdir}
1616
commands=
17-
py.test
17+
py.test tests/
1818

1919
[pytest]
2020
DJANGO_SETTINGS_MODULE = tests.django_settings

0 commit comments

Comments
 (0)