mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-29 04:53:43 +03:00
resolve django encoding deprecation warnings (#853)
https://docs.djangoproject.com/en/3.0/ref/utils/#django.utils.encoding.force_text
This commit is contained in:
parent
08f67797d8
commit
62ecbae614
|
@ -6,7 +6,7 @@ from threading import local
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
import six
|
import six
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_str
|
||||||
|
|
||||||
from .types import DjangoDebugSQL
|
from .types import DjangoDebugSQL
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class NormalCursorWrapper(object):
|
||||||
|
|
||||||
def _quote_expr(self, element):
|
def _quote_expr(self, element):
|
||||||
if isinstance(element, six.string_types):
|
if isinstance(element, six.string_types):
|
||||||
return "'%s'" % force_text(element).replace("'", "''")
|
return "'%s'" % force_str(element).replace("'", "''")
|
||||||
else:
|
else:
|
||||||
return repr(element)
|
return repr(element)
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class NormalCursorWrapper(object):
|
||||||
|
|
||||||
def _decode(self, param):
|
def _decode(self, param):
|
||||||
try:
|
try:
|
||||||
return force_text(param, strings_only=True)
|
return force_str(param, strings_only=True)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
return "(encoded string)"
|
return "(encoded string)"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user