From d9aaad4e36ba2ebba13fd1c36da9eced4f7688ad Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 15 Apr 2010 11:19:59 +0000 Subject: Fixed #13352 -- Added __repr__ method for Validation Error. Thanks to elpaso66 for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12976 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/exceptions.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'django') diff --git a/django/core/exceptions.py b/django/core/exceptions.py index 5ccd3e8c63..ee6d5fe37b 100644 --- a/django/core/exceptions.py +++ b/django/core/exceptions.py @@ -64,6 +64,11 @@ class ValidationError(Exception): return repr(self.message_dict) return repr(self.messages) + def __repr__(self): + if hasattr(self, 'message_dict'): + return 'ValidationError(%s)' % repr(self.message_dict) + return 'ValidationError(%s)' % repr(self.messages) + def update_error_dict(self, error_dict): if hasattr(self, 'message_dict'): if error_dict: -- cgit v1.3