Opened 16 years ago

Closed 11 years ago

#6535 closed Bug (fixed)

parser.compile_filter() does not support negative numbers

Reported by: Collin Grady <cgrady@…> Owned by: Aymeric Augustin
Component: Template system Version: dev
Severity: Normal Keywords: tplrf-fixed
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no


After writing a patch for #5756, a new issue presented itself - another user tried {% ifequal -1 -1 %} and it threw a TemplateSyntaxError stating that it could not parse the remainder "-1"

A small tweak to a regex in django/template/ appears to correct the issue, but I'm not sure if a better change is needed along these lines to make it so the - can only be at the start of a number.

Attachments (1)

6535.patch (478 bytes) - added by Collin Grady <cgrady@…> 16 years ago.

Download all attachments as: .zip

Change History (7)

Changed 16 years ago by Collin Grady <cgrady@…>

Attachment: 6535.patch added

comment:1 Changed 15 years ago by Jacob

Needs tests: set
Triage Stage: UnreviewedAccepted

comment:2 Changed 15 years ago by Johannes Dollinger

Keywords: tplrf-fixed added

This would be fixed by the refactoring proposed in #7806.

comment:3 Changed 13 years ago by Julien Phalip

Type: Bug

comment:4 Changed 12 years ago by Julien Phalip

Severity: Normal

comment:5 Changed 12 years ago by Aymeric Augustin

Easy pickings: unset
Owner: changed from nobody to Aymeric Augustin
UI/UX: unset

comment:6 Changed 11 years ago by Türker Sezer

Resolution: fixed
Status: newclosed

this issue already fixed.

s = "{% ifequal -1 -1 %}OK{% endifequal %}"
t = template.Template(s)
c = template.Context({})

r10169 | mtredinnick | 2009-03-25 03:45:56 +0000 (Çrş, 25 Mar 2009) | 5 lines
Template filters now pass numerical arguments through as numbers.

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