Ticket #2489: capfirst.diff

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

small fix for capfirst filter to enable unicode strings

  • www-libs/django/django/template/defaultfilters.py

     
    1919
    2020def capfirst(value):
    2121    "Capitalizes the first character of the value"
    22     value = str(value)
     22    if isinstance(value, str):
     23        # convert to unicode string
     24        value = unicode(value, settings.DEFAULT_CHARSET)
     25    elif not isinstance(value, basestring):
     26        value = unicode(value)
    2327    return value and value[0].upper() + value[1:]
    2428
    2529def fix_ampersands(value):
Back to Top