Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#9756 closed (fixed)

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

Reported by: seanl 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: UI/UX:

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 seanl 5 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:2 Changed 5 years ago by jacob

  • milestone set to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by bpeschier

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 Changed 5 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r10439.

comment:5 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.