Opened 18 years ago
Closed 18 years ago
#3749 closed (fixed)
FilterNode does not supply full context
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Keywords: | FilterNode filter tag | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
FilterNode truncates the context it passes to its filter, causing variable filter arguments to raise VariableDoesNotExist. For example, this works:
{{ obj|cut:request.GET.cut }}
This raises VariableDoesNotExist:
{% filter cut:request.GET.cut %}{{ obj }}{% endfilter %}
Attachments (2)
Change History (10)
by , 18 years ago
Attachment: | FilterNode.patch added |
---|
comment:1 by , 18 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:2 by , 18 years ago
Needs tests: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
comment:3 by , 18 years ago
Needs tests: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
comment:4 by , 18 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
Maybe I'm missing something, but context
is being pop
ped at the end of the render method even though it was never push
ed. Won't this screw up the context after this node?
comment:5 by , 18 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Context.update() pushes its argument to the beginning of the context. See http://code.djangoproject.com/browser/django/trunk/django/template/context.py#L61. All unit tests pass following this patch.
comment:6 by , 18 years ago
My mistake, thanks for checking this - I didn't get around to doing it myself.
comment:8 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks for the patch. Could you (or somebody) include some unit tests, so we can check this in?