diff --git a/graphene/contrib/django/debug/middleware.py b/graphene/contrib/django/debug/middleware.py index adf551ad..01b09e7b 100644 --- a/graphene/contrib/django/debug/middleware.py +++ b/graphene/contrib/django/debug/middleware.py @@ -1,8 +1,6 @@ from promise import Promise from django.db import connections -from ....core.schema import GraphQLSchema -from ....core.types import Field from .sql.tracking import unwrap_cursor, wrap_cursor from .types import DjangoDebug @@ -47,8 +45,10 @@ class DjangoDebugMiddleware(object): raise Exception('DjangoDebug cannot be executed in None contexts') try: context.django_debug = DjangoDebugContext() - except Exception, e: - raise Exception('DjangoDebug need the context to be writable, context received: {}.'.format(context.__class__.__name__)) + except Exception: + raise Exception('DjangoDebug need the context to be writable, context received: {}.'.format( + context.__class__.__name__ + )) if info.schema.graphene_schema.T(DjangoDebug) == info.return_type: return context.django_debug.get_debug_promise() promise = next(root, args, context, info) diff --git a/graphene/contrib/django/debug/sql/tracking.py b/graphene/contrib/django/debug/sql/tracking.py index ab31dbe5..c636646e 100644 --- a/graphene/contrib/django/debug/sql/tracking.py +++ b/graphene/contrib/django/debug/sql/tracking.py @@ -10,6 +10,7 @@ from django.utils.encoding import force_text from .types import DjangoDebugSQL, DjangoDebugPostgreSQL + class SQLQueryTriggered(Exception): """Thrown when template panel triggers a query""" diff --git a/graphene/core/types/field.py b/graphene/core/types/field.py index e7a36f84..7203b3c5 100644 --- a/graphene/core/types/field.py +++ b/graphene/core/types/field.py @@ -1,5 +1,5 @@ from collections import OrderedDict -from functools import wraps, partial +from functools import wraps import six from graphql.type import GraphQLField, GraphQLInputObjectField