Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#9756 closed (fixed)

Recent changes to for tag (adding empty clause) leave context stack imbalanced when iterable is empty

Reported by: Sean Legassick Owned by: nobody
Component: Template system Version: 1.0
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

When the iterable passed to the for tag is empty, the ForNode.render method returns without calling context.pop (which it should as context.push is called previously in the method). The attached patch fixes this and adds code to the template tag regression tests that checks that context stack is left balanced after every tag test.

Attachments (1)

for-tag-leaves-imbalanced-context-stack.patch (1.9 KB ) - added by Sean Legassick 15 years ago.

Download all attachments as: .zip

Change History (6)

by Sean Legassick, 15 years ago

comment:1 by (none), 15 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:2 by Jacob, 15 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:3 by Bas Peschier, 15 years ago

Ah, explains why an nested forloop with an empty iterable causes the .first-attribute of his parent loop to be true incorrectly. Just bumped into this one, nice to see it fixed! :-)

comment:4 by Jacob, 15 years ago

Resolution: fixed
Status: newclosed

Fixed in r10439.

comment:5 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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