diff --git a/.travis.yml b/.travis.yml index d9b9ccb..7317bec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,7 @@ language: python python: - - "2.7" - - "3.3" + - "3.8" install: - pip install -r test_requirements.txt - - pip install . --use-mirrors + - pip install . script: nosetests diff --git a/drf_ujson/parsers.py b/drf_ujson/parsers.py index 9e153ee..18942f1 100644 --- a/drf_ujson/parsers.py +++ b/drf_ujson/parsers.py @@ -2,8 +2,8 @@ from __future__ import unicode_literals from django.conf import settings -from rest_framework.compat import six -from rest_framework.parsers import BaseParser, ParseError +from rest_framework.parsers import BaseParser +from rest_framework.exceptions import ParseError from rest_framework.renderers import JSONRenderer import ujson @@ -31,4 +31,4 @@ def parse(self, stream, media_type=None, parser_context=None): data = stream.read().decode(encoding) return ujson.loads(data) except ValueError as exc: - raise ParseError('JSON parse error - %s' % six.text_type(exc)) + raise ParseError('JSON parse error - %s' % str(exc)) diff --git a/drf_ujson/renderers.py b/drf_ujson/renderers.py index 87b7b66..73b604c 100644 --- a/drf_ujson/renderers.py +++ b/drf_ujson/renderers.py @@ -1,5 +1,4 @@ from __future__ import unicode_literals -from rest_framework.compat import six from rest_framework.renderers import BaseRenderer import ujson @@ -22,8 +21,6 @@ def render(self, data, *args, **kwargs): return bytes() ret = ujson.dumps(data, ensure_ascii=self.ensure_ascii) - - # force return value to unicode - if isinstance(ret, six.text_type): + if isinstance(ret, str): return bytes(ret.encode('utf-8')) return ret diff --git a/setup.py b/setup.py index ba4e693..c69459d 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name='drf_ujson', - version='1.2', + version='2.0', description='Django Rest Framework UJSON Renderer', author='Gizmag', author_email='tech@gizmag.com',