mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 05:04:31 +03:00
Merge pull request #2315 from tomchristie/yaml-encoder-fix
YAML encoder fix for 3.0 serializers.
This commit is contained in:
commit
b8bdf812c1
|
@ -7,6 +7,7 @@ from django.utils import six, timezone
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
from django.utils.functional import Promise
|
from django.utils.functional import Promise
|
||||||
from rest_framework.compat import OrderedDict
|
from rest_framework.compat import OrderedDict
|
||||||
|
from rest_framework.utils.serializer_helpers import ReturnDict, ReturnList
|
||||||
import datetime
|
import datetime
|
||||||
import decimal
|
import decimal
|
||||||
import types
|
import types
|
||||||
|
@ -107,14 +108,14 @@ else:
|
||||||
OrderedDict,
|
OrderedDict,
|
||||||
yaml.representer.SafeRepresenter.represent_dict
|
yaml.representer.SafeRepresenter.represent_dict
|
||||||
)
|
)
|
||||||
# SafeDumper.add_representer(
|
SafeDumper.add_representer(
|
||||||
# DictWithMetadata,
|
ReturnDict,
|
||||||
# yaml.representer.SafeRepresenter.represent_dict
|
yaml.representer.SafeRepresenter.represent_dict
|
||||||
# )
|
)
|
||||||
# SafeDumper.add_representer(
|
SafeDumper.add_representer(
|
||||||
# OrderedDictWithMetadata,
|
ReturnList,
|
||||||
# yaml.representer.SafeRepresenter.represent_dict
|
yaml.representer.SafeRepresenter.represent_list
|
||||||
# )
|
)
|
||||||
SafeDumper.add_representer(
|
SafeDumper.add_representer(
|
||||||
types.GeneratorType,
|
types.GeneratorType,
|
||||||
yaml.representer.SafeRepresenter.represent_list
|
yaml.representer.SafeRepresenter.represent_list
|
||||||
|
|
Loading…
Reference in New Issue
Block a user