diff options
| author | Tom Christie | 2014-10-01 13:09:14 +0100 |
|---|---|---|
| committer | Tom Christie | 2014-10-01 13:09:14 +0100 |
| commit | 381771731f48c75e7d5951e353049cceec386512 (patch) | |
| tree | bc426b11d4ba33cbbb2063e3393f8855c7841fd8 /rest_framework/utils/encoders.py | |
| parent | bb2222963f527638ed2bc9a817415102312e12e0 (diff) | |
| download | django-rest-framework-381771731f48c75e7d5951e353049cceec386512.tar.bz2 | |
Use six.text_type instead of str everywhere
Diffstat (limited to 'rest_framework/utils/encoders.py')
| -rw-r--r-- | rest_framework/utils/encoders.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index 174b08b8..7c4179a1 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -2,8 +2,8 @@ Helper classes for parsers. """ from __future__ import unicode_literals -from django.utils import timezone from django.db.models.query import QuerySet +from django.utils import six, timezone from django.utils.datastructures import SortedDict from django.utils.functional import Promise from rest_framework.compat import force_text @@ -40,7 +40,7 @@ class JSONEncoder(json.JSONEncoder): representation = representation[:12] return representation elif isinstance(obj, datetime.timedelta): - return str(obj.total_seconds()) + return six.text_type(obj.total_seconds()) elif isinstance(obj, decimal.Decimal): # Serializers will coerce decimals to strings by default. return float(obj) @@ -72,7 +72,7 @@ else: than the usual behaviour of sorting the keys. """ def represent_decimal(self, data): - return self.represent_scalar('tag:yaml.org,2002:str', str(data)) + return self.represent_scalar('tag:yaml.org,2002:str', six.text_type(data)) def represent_mapping(self, tag, mapping, flow_style=None): value = [] |
