Skip to content

Commit 3dcb53a

Browse files
committed
Merge pull request #159 from graphql-python/core-update
Core update GraphQL-core 0.5.0
2 parents 079014b + 7be5b83 commit 3dcb53a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+158
-125
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ install:
2525
if [ "$TEST_TYPE" = build ]; then
2626
pip install --download-cache $HOME/.cache/pip/ pytest pytest-cov coveralls six pytest-django django-filter sqlalchemy_utils
2727
pip install --download-cache $HOME/.cache/pip psycopg2 > /dev/null 2>&1
28+
pip install --download-cache $HOME/.cache/pip/ -e .
2829
pip install --download-cache $HOME/.cache/pip/ -e .[django]
2930
pip install --download-cache $HOME/.cache/pip/ -e .[sqlalchemy]
3031
pip install django==$DJANGO_VERSION
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
from django.test import TestCase
21

32
# Create your tests here.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
from django.shortcuts import render
21

32
# Create your views here.

examples/cookbook_django/cookbook/recipes/migrations/0001_initial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Generated by Django 1.9 on 2015-12-04 18:20
33
from __future__ import unicode_literals
44

5-
from django.db import migrations, models
65
import django.db.models.deletion
6+
from django.db import migrations, models
77

88

99
class Migration(migrations.Migration):
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
from django.test import TestCase
21

32
# Create your tests here.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
from django.shortcuts import render
21

32
# Create your views here.

graphene/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
)
3434

3535
from graphene.utils import (
36-
resolve_only_args
36+
resolve_only_args,
37+
with_context
3738
)
3839

3940
__all__ = [
@@ -65,4 +66,5 @@
6566
'ListField',
6667
'NonNullField',
6768
'FloatField',
68-
'resolve_only_args']
69+
'resolve_only_args',
70+
'with_context']

graphene/contrib/django/debug/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ def wrap_schema(self, schema_type):
7272

7373
@contextmanager
7474
def context_execution(self, executor):
75-
executor['root'] = WrappedRoot(root=executor['root'])
75+
executor['root_value'] = WrappedRoot(root=executor.get('root_value'))
7676
executor['schema'] = self.wrap_schema(executor['schema'])
77-
self.enable_instrumentation(executor['root'])
77+
self.enable_instrumentation(executor['root_value'])
7878
yield executor
7979
self.disable_instrumentation()

graphene/contrib/django/filter/filterset.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@
44
from django.utils.text import capfirst
55
from django_filters import Filter, MultipleChoiceFilter
66
from django_filters.filterset import FilterSet, FilterSetMetaclass
7-
from graphql_relay.node.node import from_global_id
87

98
from graphene.contrib.django.forms import (GlobalIDFormField,
109
GlobalIDMultipleChoiceField)
10+
from graphql_relay.node.node import from_global_id
1111

1212

1313
class GlobalIDFilter(Filter):
1414
field_class = GlobalIDFormField
1515

1616
def filter(self, qs, value):
17-
gid = from_global_id(value)
18-
return super(GlobalIDFilter, self).filter(qs, gid.id)
17+
_type, _id = from_global_id(value)
18+
return super(GlobalIDFilter, self).filter(qs, _id)
1919

2020

2121
class GlobalIDMultipleChoiceFilter(MultipleChoiceFilter):
2222
field_class = GlobalIDMultipleChoiceField
2323

2424
def filter(self, qs, value):
25-
gids = [from_global_id(v).id for v in value]
25+
gids = [from_global_id(v)[1] for v in value]
2626
return super(GlobalIDMultipleChoiceFilter, self).filter(qs, gids)
2727

2828

graphene/contrib/django/forms.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from django.core.exceptions import ValidationError
44
from django.forms import CharField, Field, IntegerField, MultipleChoiceField
55
from django.utils.translation import ugettext_lazy as _
6+
67
from graphql_relay import from_global_id
78

89

@@ -16,13 +17,13 @@ def clean(self, value):
1617
return None
1718

1819
try:
19-
gid = from_global_id(value)
20+
_type, _id = from_global_id(value)
2021
except (TypeError, ValueError, UnicodeDecodeError, binascii.Error):
2122
raise ValidationError(self.error_messages['invalid'])
2223

2324
try:
24-
IntegerField().clean(gid.id)
25-
CharField().clean(gid.type)
25+
IntegerField().clean(_id)
26+
CharField().clean(_type)
2627
except ValidationError:
2728
raise ValidationError(self.error_messages['invalid'])
2829

0 commit comments

Comments
 (0)