Code

Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#486 closed defect (fixed)

[patch] Template system incorrectly persists filter arguments

Reported by: ilikeprivacy@… Owned by: adrian
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: UI/UX:

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 9 years ago.
Fix for argimunt bug in template system

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by Simon Willison

Fix for argimunt bug in template system

comment:1 Changed 9 years ago by Simon Willison

  • Severity changed from normal to major
  • Summary changed from Filter 'escape' should not have an argument (it doesn't) to [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 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [486].

comment:3 Changed 9 years ago by adrian

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.