Opened 19 years ago

Closed 19 years ago

Last modified 17 years ago

#486 closed defect (fixed)

[patch] Template system incorrectly persists filter arguments

Reported by: ilikeprivacy@… Owned by: Adrian Holovaty
Component: Template system Version:
Severity: major Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I've got some text which has had php's nl2br applied to it at some point in the past.

when I apply the following filters

{{topic.body|removetags:"p a br"|escape|linebreaks}}

I receive the following error

..........
  File "/usr/lib/python2.3/site-packages/django/core/template.py", line 298, in read_filters
    raise TemplateSyntaxError, "Filter '%s' should not have an argument" % filter_name

TemplateSyntaxError: Filter 'escape' should not have an argument

it does not appear to have this issue when I remove the linebreaks filter

Attachments (1)

template-args-fix.patch (1021 bytes ) - added by Simon Willison 19 years ago.
Fix for argimunt bug in template system

Download all attachments as: .zip

Change History (4)

by Simon Willison, 19 years ago

Attachment: template-args-fix.patch added

Fix for argimunt bug in template system

comment:1 by Simon Willison, 19 years ago

Severity: normalmajor
Summary: Filter 'escape' should not have an argument (it doesn't)[patch] Template system incorrectly persists filter arguments

Great catch. It seems that the template system, in certain cases, keeps the argument from the previous filter around. The attached patch fixes this bug.

comment:2 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

Fixed in [486].

comment:3 by Adrian Holovaty, 19 years ago

Whoop, I meant it was fixed in [634].

Note: See TracTickets for help on using tickets.
Back to Top