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