These should either be function calls ala self.errors() I think, or what I have here which is self._errors. This fixes annoying bugs that got introduced in 3.1 to 3.2 that would cause 400 errors on invalid requests to become mysterious 500 errors.

This commit is contained in:
radams 2015-10-21 18:01:56 -04:00
parent 71338ddd3f
commit 2d755ead3c

View File

@ -157,7 +157,7 @@ class BaseSerializer(Field):
'You must call `.is_valid()` before calling `.save()`.'
)
assert not self.errors, (
assert not self._errors, (
'You cannot call `.save()` on a serializer with invalid data.'
)
@ -218,7 +218,7 @@ class BaseSerializer(Field):
self._errors = {}
if self._errors and raise_exception:
raise ValidationError(self.errors)
raise ValidationError(self._errors)
return not bool(self._errors)