summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Bistuer <loic.bistuer@sixmedia.com>2013-12-07 23:01:17 +0700
committerLoic Bistuer <loic.bistuer@sixmedia.com>2013-12-07 23:01:28 +0700
commit2e3c7d882015375c130c21884d83cb9fb7759d94 (patch)
tree33491e1817c489d2610e5a5b9b58b392e601a8e8
parent65faa84de3fd3f42e938301574cccdec1578657d (diff)
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.
-rw-r--r--django/core/exceptions.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/core/exceptions.py b/django/core/exceptions.py
index 78f6d07cf3..cf4aea0f36 100644
--- a/django/core/exceptions.py
+++ b/django/core/exceptions.py
@@ -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