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/tests/regressiontests/humanize/tests.py

    r5985 r6671  
    44from django.utils.dateformat import DateFormat 
    55from django.utils.translation import ugettext as _ 
     6from django.utils.html import escape 
    67 
    78add_to_builtins('django.contrib.humanize.templatetags.humanize') 
     
    1617            t = Template('{{ test_content|%s }}' % method) 
    1718            rendered = t.render(Context(locals())).strip() 
    18             self.assertEqual(rendered, result_list[index]
     19            self.assertEqual(rendered, escape(result_list[index])
    1920                             msg="%s test failed, produced %s, should've produced %s" % (method, rendered, result_list[index])) 
    2021