This is from django r5773:
class ValidationError(Exception):
def __init__(self, message):
"ValidationError can be passed a string or a
list."
if isinstance(message, list):
self.messages = ErrorList([smart_unicode(msg)
for msg in
message])
else:
assert isinstance(message, basestring),
("%s should be a
basestring" % repr(message))
message = smart_unicode(message)
self.messages = ErrorList([message])
def __str__(self):
# This is needed because, without a __str__(),
printing an
exception
# instance would result in this:
# AttributeError: ValidationError instance has no
attribute
'args'
# See http://www.python.org/doc/current/tut/node10.html#hand
ling
return repr(self.messages)
I don't understand the line:
assert isinstance(message, basestring), ("%s should be
a basestring" %
repr(message))
I think it should be OK if message is an instance of
Promise. And
usually the message IS instance of Promise if using i18n.
--~--~---------~--~----~------------~-------~--~----~
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 htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|