Django

Code

Show
Ignore:
Timestamp:
11/14/07 06:58:53 (1 year ago)
Author:
mtredinnick
Message:

Implemented auto-escaping of variable output in templates. Fully controllable by template authors and it's possible to write filters and templates that simulataneously work in both auto-escaped and non-auto-escaped environments if you need to. Fixed #2359

See documentation in templates.txt and templates_python.txt for how everything
works.

Backwards incompatible if you're inserting raw HTML output via template variables.

Based on an original design from Simon Willison and with debugging help from Michael Radziej.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/humanize/templatetags/humanize.py

    r5985 r6671  
    2222        return u"%d%s" % (value, t[0]) 
    2323    return u'%d%s' % (value, t[value % 10]) 
     24ordinal.is_safe = True 
    2425register.filter(ordinal) 
    2526 
     
    3536    else: 
    3637        return intcomma(new) 
     38intcomma.is_safe = True 
    3739register.filter(intcomma) 
    3840 
     
    5658        return ungettext('%(value).1f trillion', '%(value).1f trillion', new_value) % {'value': new_value} 
    5759    return value 
     60intword.is_safe = False 
    5861register.filter(intword) 
    5962 
     
    7073        return value 
    7174    return (_('one'), _('two'), _('three'), _('four'), _('five'), _('six'), _('seven'), _('eight'), _('nine'))[value-1] 
     75apnumber.is_safe = True 
    7276register.filter(apnumber) 
    7377