Hallöchen!

Up to 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 for years, 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.

The safe and obvious workaround is to use mark_safe() as a function
instead of @mark_safe.  Would be a pity, though.

Is this a bug or am I doing something wrong?

Tschö,
Torsten.

-- 
Torsten Bronger

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/87vabxj2s4.fsf%40wilson.bronger.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to