Opened 18 years ago
Closed 13 years ago
#6535 closed Bug (fixed)
parser.compile_filter() does not support negative numbers
| Reported by: | 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 |
Description
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/__init__.py 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)
Change History (7)
by , 18 years ago
| Attachment: | 6535.patch added |
|---|
comment:1 by , 17 years ago
| Needs tests: | set |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 17 years ago
| Keywords: | tplrf-fixed added |
|---|
comment:3 by , 15 years ago
| Type: | → Bug |
|---|
comment:4 by , 14 years ago
| Severity: | → Normal |
|---|
comment:5 by , 14 years ago
| Easy pickings: | unset |
|---|---|
| Owner: | changed from to |
| UI/UX: | unset |
comment:6 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
this issue already fixed.
s = "{% ifequal -1 -1 %}OK{% endifequal %}"
t = template.Template(s)
c = template.Context({})
t.render(c)
u'OK'
r10169 | mtredinnick | 2009-03-25 03:45:56 +0000 (Çrş, 25 Mar 2009) | 5 lines
Template filters now pass numerical arguments through as numbers.
This would be fixed by the refactoring proposed in #7806.