aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/utils/encoders.py
diff options
context:
space:
mode:
authorCezar Pendarovski2014-08-25 17:28:22 +0200
committerCezar Pendarovski2014-08-25 17:28:22 +0200
commitf6cbd88618553c394b5c62761ec1506e903de267 (patch)
tree6e557dbb3ccb2ce7f864efe78658ca2a44937282 /rest_framework/utils/encoders.py
parent4d582fd9ffcb6ec28247e95b63134c00cc131780 (diff)
parent21a0a826bba3df01e72ea8b0390e05d50cf9a854 (diff)
downloaddjango-rest-framework-f6cbd88618553c394b5c62761ec1506e903de267.tar.bz2
Merge remote-tracking branch 'upstream/master' into fix-1719
Conflicts: rest_framework/templates/rest_framework/base.html
Diffstat (limited to 'rest_framework/utils/encoders.py')
-rw-r--r--rest_framework/utils/encoders.py34
1 files changed, 22 insertions, 12 deletions
diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py
index e5fa4194..00ffdfba 100644
--- a/rest_framework/utils/encoders.py
+++ b/rest_framework/utils/encoders.py
@@ -2,10 +2,11 @@
Helper classes for parsers.
"""
from __future__ import unicode_literals
+from django.utils import timezone
from django.db.models.query import QuerySet
from django.utils.datastructures import SortedDict
from django.utils.functional import Promise
-from rest_framework.compat import timezone, force_text
+from rest_framework.compat import force_text
from rest_framework.serializers import DictWithMetadata, SortedDictWithMetadata
import datetime
import decimal
@@ -97,14 +98,23 @@ else:
node.flow_style = best_style
return node
- SafeDumper.add_representer(decimal.Decimal,
- SafeDumper.represent_decimal)
-
- SafeDumper.add_representer(SortedDict,
- yaml.representer.SafeRepresenter.represent_dict)
- SafeDumper.add_representer(DictWithMetadata,
- yaml.representer.SafeRepresenter.represent_dict)
- SafeDumper.add_representer(SortedDictWithMetadata,
- yaml.representer.SafeRepresenter.represent_dict)
- SafeDumper.add_representer(types.GeneratorType,
- yaml.representer.SafeRepresenter.represent_list)
+ SafeDumper.add_representer(
+ decimal.Decimal,
+ SafeDumper.represent_decimal
+ )
+ SafeDumper.add_representer(
+ SortedDict,
+ yaml.representer.SafeRepresenter.represent_dict
+ )
+ SafeDumper.add_representer(
+ DictWithMetadata,
+ yaml.representer.SafeRepresenter.represent_dict
+ )
+ SafeDumper.add_representer(
+ SortedDictWithMetadata,
+ yaml.representer.SafeRepresenter.represent_dict
+ )
+ SafeDumper.add_representer(
+ types.GeneratorType,
+ yaml.representer.SafeRepresenter.represent_list
+ )