mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #17906 - Autoescaping {% cycle %} and {% firstof %} templatetags.
This commit adds "future" version of these two tags with auto-escaping enabled.
This commit is contained in:
committed by
Aymeric Augustin
parent
a61dbd6219
commit
f49e9a517f
@@ -160,6 +160,34 @@ Backwards incompatible changes in 1.6
|
||||
Features deprecated in 1.6
|
||||
==========================
|
||||
|
||||
Changes to :ttag:`cycle` and :ttag:`firstof`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The template system generally escapes all variables to avoid XSS attacks.
|
||||
However, due to an accident of history, the :ttag:`cycle` and :ttag:`firstof`
|
||||
tags render their arguments as-is.
|
||||
|
||||
Django 1.6 starts a process to correct this inconsistency. The ``future``
|
||||
template library provides alternate implementations of :ttag:`cycle` and
|
||||
:ttag:`firstof` that autoescape their inputs. If you're using these tags,
|
||||
you're encourage to include the following line at the top of your templates to
|
||||
enable the new behavior::
|
||||
|
||||
{% load cycle from future %}
|
||||
|
||||
or::
|
||||
|
||||
{% load firstof from future %}
|
||||
|
||||
The tags implementing the old behavior have been deprecated, and in Django
|
||||
1.8, the old behavior will be replaced with the new behavior. To ensure
|
||||
compatibility with future versions of Django, existing templates should be
|
||||
modified to use the ``future`` versions.
|
||||
|
||||
If necessary, you can temporarily disable auto-escaping with
|
||||
:func:`~django.utils.safestring.mark_safe` or :ttag:`{% autoescape off %}
|
||||
<autoescape>`.
|
||||
|
||||
``SEND_BROKEN_LINK_EMAILS`` setting
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
Reference in New Issue
Block a user