#29400: mark_safe does not work as a decorator for filters and tags (regression)
-------------------------------------------+------------------------
Reporter: Torsten Bronger | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.0
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 |
-------------------------------------------+------------------------
With Django 1.11, I had the following pattern frequently in my code:
{{{
@register.filter
@mark_safe
def myfilter(value):
...
}}}
Smilarly for tags. This has worked in Django 1.11, however, with Django
2.0, this leads to the TemplateError saying that "myfilter requires 0
arguments, 1 provided". For tags, it results in an IndexError because the
"params" list when processing the tag is empty.
If I make @mark_safe the outmost (i.e. first) decorator, no exception
occurs – but the output is escaped HTML instead of passed-through HTML.
--
Ticket URL: <https://code.djangoproject.com/ticket/29400>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.24817768dc54e7671043d4a845de09ed%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.