Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion graphene_sqlalchemy/enums.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import six
from sqlalchemy.orm import ColumnProperty
from sqlalchemy.types import Enum as SQLAlchemyEnumType

Expand Down Expand Up @@ -62,7 +63,7 @@ def enum_for_field(obj_type, field_name):
if not isinstance(obj_type, type) or not issubclass(obj_type, SQLAlchemyObjectType):
raise TypeError(
"Expected SQLAlchemyObjectType, but got: {!r}".format(obj_type))
if not field_name or not isinstance(field_name, str):
if not field_name or not isinstance(field_name, six.string_types):
raise TypeError(
"Expected a field name, but got: {!r}".format(field_name))
registry = obj_type._meta.registry
Expand Down
3 changes: 2 additions & 1 deletion graphene_sqlalchemy/fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import warnings
from functools import partial

import six
from promise import Promise, is_thenable
from sqlalchemy.orm.query import Query

Expand Down Expand Up @@ -35,7 +36,7 @@ def model(self):
def get_query(cls, model, info, sort=None, **args):
query = get_query(model, info.context)
if sort is not None:
if isinstance(sort, str):
if isinstance(sort, six.string_types):
query = query.order_by(sort.value)
else:
query = query.order_by(*(col.value for col in sort))
Expand Down
3 changes: 2 additions & 1 deletion graphene_sqlalchemy/registry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import defaultdict

import six
from sqlalchemy.types import Enum as SQLAlchemyEnumType

from graphene import Enum
Expand Down Expand Up @@ -42,7 +43,7 @@ def register_orm_field(self, obj_type, field_name, orm_field):
raise TypeError(
"Expected SQLAlchemyObjectType, but got: {!r}".format(obj_type)
)
if not field_name or not isinstance(field_name, str):
if not field_name or not isinstance(field_name, six.string_types):
raise TypeError("Expected a field name, but got: {!r}".format(field_name))
self._registry_orm_fields[obj_type][field_name] = orm_field

Expand Down