diff options
| author | Tom Christie | 2014-08-20 12:06:29 +0100 |
|---|---|---|
| committer | Tom Christie | 2014-08-20 12:06:29 +0100 |
| commit | 6ffc97c808f8026c063011e2d048604f3a6b70fa (patch) | |
| tree | 93586ece6e50ab5ef6282ffd104e886ed48d9180 /rest_framework/utils/encoders.py | |
| parent | f7b3e1e62b8e2c8bd1d1eb79a1cb0b3f4a0559a9 (diff) | |
| parent | 874d2be83c612fb5e04aa6a28901c2afe4bf9d3b (diff) | |
| download | django-rest-framework-6ffc97c808f8026c063011e2d048604f3a6b70fa.tar.bz2 | |
Merge pull request #1770 from tomchristie/2.4.0
2.4.0 Release.
Diffstat (limited to 'rest_framework/utils/encoders.py')
| -rw-r--r-- | rest_framework/utils/encoders.py | 34 |
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 + ) |
