Skip to content

Commit

Permalink
Merge pull request #2315 from tomchristie/yaml-encoder-fix
Browse files Browse the repository at this point in the history
YAML encoder fix for 3.0 serializers.
  • Loading branch information
tomchristie committed Dec 18, 2014
2 parents 1e531d2 + a68d933 commit b8bdf81
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions rest_framework/utils/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
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
Expand Down Expand Up @@ -107,14 +108,14 @@ def represent_mapping(self, tag, mapping, flow_style=None):
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
Expand Down

0 comments on commit b8bdf81

Please sign in to comment.