Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#10644 closed (fixed)

undocumented context side-effect in {% ifchanged %}

Reported by: Antti Kaihola Owned by: nobody
Component: Template system Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The {% ifchanged %} template tag sets the {{ ifchanged }} variable in its local context, in a way similar to how {% for %} sets the {{ forloop }} variable. This behavior is not documented. The value stored into the variable is a dictionary and doesn't seem to have any use elsewhere in Django. Maybe it's related to some removed functionality?

These quick Google code searches didn't turn up any uses of the context variable in indexed open source projects either:

The following patch stops {% ifchanged %} from touching the context and adds a test for this.

Attachments (1)

10644_ifchanged.1.diff (1.6 KB ) - added by Antti Kaihola 16 years ago.
Patch: stop {% ifchanged %} from changing context, includes test

Download all attachments as: .zip

Change History (5)

by Antti Kaihola, 16 years ago

Attachment: 10644_ifchanged.1.diff added

Patch: stop {% ifchanged %} from changing context, includes test

comment:1 by Antti Kaihola, 16 years ago

Version: 1.0SVN

comment:2 by Jacob, 16 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:3 by Jacob, 16 years ago

Resolution: fixed
Status: newclosed

(In [10438]) Fixed #10644: removed an undocumented, unused, and (as far as I can tell) unnecessary "feature" of the ifchanged tag. Thanks, akaihola.

comment:4 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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