﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13352	ValidationError should be able to repr itself	elpaso66	nobody	"Actual behaviour:

{{{
In [1]: from django.core.exceptions import *

In [2]: ValidationError('Test')
Out[2]: ValidationError()

In [3]: ValidationError(['Test1', 'Test2'])
Out[3]: ValidationError()

}}}


Expected behaviour:

{{{
In [1]: from django.core.exceptions import *

In [2]: ValidationError('Test')
Out[2]: ValidationError([u'Test'])

In [3]: ValidationError(['Test1', 'Test2'])
Out[3]: ValidationError([u'Test1', u'Test2'])
}}}

Patch:

{{{
Index: django/core/exceptions.py
===================================================================
--- django/core/exceptions.py   (revision 12889)
+++ django/core/exceptions.py   (working copy)
@@ -64,6 +64,11 @@
             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:

}}}

"		closed	Core (Other)	1.1		fixed			Accepted	1	0	1	0	0	0
