Ticket #5370: 5370.diff

File 5370.diff, 860 bytes (added by James Bennett, 17 years ago)

Patch which allows basestring or Promise

  • django/newforms/util.py

     
    11from django.utils.html import escape
    22from django.utils.encoding import smart_unicode, StrAndUnicode
     3from django.utils.functional import Promise
    34
    45def flatatt(attrs):
    56    """
     
    4748        if isinstance(message, list):
    4849            self.messages = ErrorList([smart_unicode(msg) for msg in message])
    4950        else:
    50             assert isinstance(message, basestring), ("%s should be a basestring" % repr(message))
     51            assert isinstance(message, (basestring, Promise)), ("%s should be a basestring or lazy translation" % repr(message))
    5152            message = smart_unicode(message)
    5253            self.messages = ErrorList([message])
    5354
Back to Top