mirror of
https://github.com/django/django.git
synced 2024-11-29 22:56:46 +01:00
Trigger AttributeError in ValidationError.message_dict when error_dict is missing.
The goal of this change is twofold; firstly, matching the behavior of Django 1.6 and secondly, an AttributeError is more informative than an obscure ValueError about mismatching sequence lengths. Refs #20867.
This commit is contained in:
parent
65faa84de3
commit
2e3c7d8820
@ -123,6 +123,10 @@ class ValidationError(Exception):
|
||||
|
||||
@property
|
||||
def message_dict(self):
|
||||
# Trigger an AttributeError if this ValidationError
|
||||
# doesn't have an error_dict.
|
||||
getattr(self, 'error_dict')
|
||||
|
||||
return dict(self)
|
||||
|
||||
@property
|
||||
|
Loading…
Reference in New Issue
Block a user