Ticket #3314: form_utils.diff

File form_utils.diff, 590 bytes (added by nesh <nesh [at] studioquattro [dot] co [dot] yu>, 18 years ago)

smart_unicode patch

  • www-libs/django/django/newforms/util.py

     
    77
    88def smart_unicode(s):
    99    if not isinstance(s, basestring):
    10         s = unicode(str(s))
     10        if hasattr(s, '__unicode__'):
     11            s = unicode(s)
     12        else:
     13            s = unicode(str(s), settings.DEFAULT_CHARSET)
    1114    elif not isinstance(s, unicode):
    1215        s = unicode(s, settings.DEFAULT_CHARSET)
    1316    return s
Back to Top