Sunday, December 4, 2011

ValidationError to error message

I cannot understand the following behaviour:

>>> from django.core.exceptions import ValidationError
>>> str(ValidationError('so and so'))
"[u'so and so']"
>>> str(Exception('so and so'))
'so and so'

How do I convert a ValidationError to a str for composing a human
readable message? Even if ValidationError is derived from Exception,
its conversion to str is different... what is the right way to get the
message in a ValidationError?

E.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate