self._errors might be None when nesting serializers

This commit is contained in:
Tim-Erwin 2014-10-01 15:35:28 +02:00
parent a8622adcd9
commit 8956845077

View File

@ -272,6 +272,7 @@ class BaseSerializer(WritableField):
Converts a dictionary of data into a dictionary of deserialized fields. Converts a dictionary of data into a dictionary of deserialized fields.
""" """
reverted_data = {} reverted_data = {}
self._errors = self._errors or {}
if data is not None and not isinstance(data, dict): if data is not None and not isinstance(data, dict):
self._errors['non_field_errors'] = ['Invalid data'] self._errors['non_field_errors'] = ['Invalid data']