diff options
| author | Tom Christie | 2013-03-08 22:43:46 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-03-08 22:43:46 +0000 |
| commit | 28ae26466e1b1493feeba19480c6eb148d603330 (patch) | |
| tree | 61b27ea9e843742dabeccfdd49fcf75ec7ae8683 /rest_framework/serializers.py | |
| parent | 0b6267d8cd45995585f0c02a4f9c96c0691fd32f (diff) | |
| download | django-rest-framework-28ae26466e1b1493feeba19480c6eb148d603330.tar.bz2 | |
Py3k fixes.
Diffstat (limited to 'rest_framework/serializers.py')
| -rw-r--r-- | rest_framework/serializers.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 25790dbc..106e3f17 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -7,8 +7,7 @@ from django.core.paginator import Page from django.db import models from django.forms import widgets from django.utils.datastructures import SortedDict -from rest_framework.compat import get_concrete_model -from rest_framework.compat import six +from rest_framework.compat import get_concrete_model, six # Note: We do the following so that users of the framework can use this style: # @@ -326,7 +325,7 @@ class BaseSerializer(Field): if self.many is not None: many = self.many else: - many = hasattr(obj, '__iter__') and not isinstance(obj, (Page, dict)) + many = hasattr(obj, '__iter__') and not isinstance(obj, (Page, dict, six.text_type)) if many: return [self.to_native(item) for item in obj] @@ -344,7 +343,7 @@ class BaseSerializer(Field): if self.many is not None: many = self.many else: - many = hasattr(data, '__iter__') and not isinstance(data, (Page, dict)) + many = hasattr(data, '__iter__') and not isinstance(data, (Page, dict, six.text_type)) if many: warnings.warn('Implict list/queryset serialization is due to be deprecated. ' 'Use the `many=True` flag when instantiating the serializer.', @@ -362,6 +361,7 @@ class BaseSerializer(Field): if not self._errors: self.object = ret + return self._errors def is_valid(self): |
