Kaydet (Commit) e1cb961a authored tarafından Malcolm Tredinnick's avatar Malcolm Tredinnick

Fixed #5370 -- Allow lazy translations in ValidationError classes. Patch from James Bennett.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6140 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst a9fd677c
from django.utils.html import escape
from django.utils.encoding import smart_unicode, StrAndUnicode
from django.utils.functional import Promise
def flatatt(attrs):
"""
......@@ -47,7 +48,7 @@ class ValidationError(Exception):
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))
assert isinstance(message, (basestring, Promise)), ("%s should be a basestring or lazy translation" % repr(message))
message = smart_unicode(message)
self.messages = ErrorList([message])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment