mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
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:
parent
71338ddd3f
commit
2d755ead3c
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user