diff options
| author | Tom Christie | 2014-12-05 13:14:14 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-05 13:14:14 +0000 |
| commit | 65d6cba75f9db0995020f01e9144b6660feb47d6 (patch) | |
| tree | 1212187336ad9f887a4c69dc805506d49f42b86e /rest_framework/utils | |
| parent | 9fb1b396db751234a531dabacb6758ac2645776c (diff) | |
| parent | d9930181ee157f51e2fcea33a3af5ea397647324 (diff) | |
| download | django-rest-framework-65d6cba75f9db0995020f01e9144b6660feb47d6.tar.bz2 | |
Merge pull request #2200 from maryokhin/master
Clean up compat code
Diffstat (limited to 'rest_framework/utils')
| -rw-r--r-- | rest_framework/utils/encoders.py | 3 | ||||
| -rw-r--r-- | rest_framework/utils/mediatypes.py | 5 | ||||
| -rw-r--r-- | rest_framework/utils/representation.py | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index 4d6bb3a3..adc83e57 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -4,8 +4,9 @@ Helper classes for parsers. from __future__ import unicode_literals from django.db.models.query import QuerySet from django.utils import six, timezone +from django.utils.encoding import force_text from django.utils.functional import Promise -from rest_framework.compat import force_text, OrderedDict +from rest_framework.compat import OrderedDict import datetime import decimal import types diff --git a/rest_framework/utils/mediatypes.py b/rest_framework/utils/mediatypes.py index 87b3cc6a..de2931c2 100644 --- a/rest_framework/utils/mediatypes.py +++ b/rest_framework/utils/mediatypes.py @@ -5,6 +5,7 @@ See http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7 """ from __future__ import unicode_literals from django.http.multipartparser import parse_header +from django.utils.encoding import python_2_unicode_compatible from rest_framework import HTTP_HEADER_ENCODING @@ -43,6 +44,7 @@ def order_by_precedence(media_type_lst): return [media_types for media_types in ret if media_types] +@python_2_unicode_compatible class _MediaType(object): def __init__(self, media_type_str): if media_type_str is None: @@ -79,9 +81,6 @@ class _MediaType(object): return 3 def __str__(self): - return self.__unicode__().encode('utf-8') - - def __unicode__(self): ret = "%s/%s" % (self.main_type, self.sub_type) for key, val in self.params.items(): ret += "; %s=%s" % (key, val) diff --git a/rest_framework/utils/representation.py b/rest_framework/utils/representation.py index 2a7c4675..3f17a8b9 100644 --- a/rest_framework/utils/representation.py +++ b/rest_framework/utils/representation.py @@ -3,8 +3,8 @@ Helper functions for creating user-friendly representations of serializer classes and serializer fields. """ from django.db import models +from django.utils.encoding import force_text from django.utils.functional import Promise -from rest_framework.compat import force_text import re |
