#17135: stringfilter decorator is incompatible with is_safe / needs_autoescape
flags
-------------------------------------------+------------------------
Reporter: aaugustin | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.3
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
Defining a template filter like this doesn't work:
{{{
@register.filter
@stringfilter
def passthrough(value):
return value
passthrough.is_safe = True
}}}
The problem is that the `stringfilter` decorator keeps a pointer to the
underlying function, and the template engine uses it.
However, the last line only sets `is_safe` on the function returned by the
decorator, not on the underlying function. As a consequence, the template
filter doesn't know that the filter is safe.
--
Ticket URL: <https://code.djangoproject.com/ticket/17135>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.