Opened 13 years ago
Closed 13 years ago
#17660 closed Bug (fixed)
extends template tag mishandles filter expressions
Reported by: | FunkyBob | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
For unknown reasons, the {% extends %} tag tries to manually identify string literals as the argument, by testing if they start and end with the same char, and that char is ' or "
This test fails with the following trivial case:
{% extends "something"|afilter:"else" %}
I can see little to no reason not to switch to using the same argument filtering as everyone else, except for the _tiny_ amount of extra debug information provided.
Attachments (5)
Change History (11)
by , 13 years ago
Attachment: | 17660.patch added |
---|
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 13 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Needs a test and a quick note in the changes docs that the ExtendsNode
definition changed (even though it's not documented, it's still a nice thing to mention)
comment:4 by , 13 years ago
You could easily keep the "tiny bit of debugging" with this:
if self.parent_name.filters or isinstance(self.parent_name.var, Variable):
by , 13 years ago
Attachment: | 17660a.patch added |
---|
After further discussion with SmileyChris, here is a patch which doesn't lose the extra debugging info, instead showing the actual expression used.
comment:5 by , 13 years ago
The notes should mention the change in arguments to the ExtendsNode
for anyone who may have been extending/using it in their tag.
Fair's fair... it was bradleyayers who brought this bug to my attention... I just formulated the patch.