From a68d9331fcb0d461ee3dfd4e3e6cf9f0f6b7b988 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 18 Dec 2014 12:17:46 +0000 Subject: [PATCH] YAML encoder fix for 3.0 serializers. --- rest_framework/utils/encoders.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index adc83e574..73cbe5d8a 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -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