#259 closed defect (fixed)
for-loop variable is undefined outside a loop in a function defined in a code block
Reported by: | kjkuan@… | Owned by: | cmlenz |
---|---|---|---|
Priority: | minor | Milestone: | 0.6 |
Component: | Template processing | Version: | 0.5.1 |
Keywords: | Cc: |
Description
<?python def bug(): for i in range(10): if i == 5: break return i # gives undefined error ?>
a workaround is to define i before the loop.
Also, if we use bug() in this context:
<li py:for="i in 0,0,0,0"> <pre>${bug()}</pre> </li>
the i returned by bug() seems to be the i used in the py:for, that is 0. Is this the intended behaviour?
Change History (6)
comment:1 Changed 16 years ago by anonymous
- Component changed from General to Template processing
comment:2 Changed 16 years ago by anonymous
- Milestone changed from 0.6 to 0.5.2
comment:3 in reply to: ↑ description Changed 16 years ago by anonymous
- Resolution set to duplicate
- Status changed from new to closed
comment:4 Changed 16 years ago by ebray
- Resolution duplicate deleted
- Status changed from closed to reopened
Dear anonymous, Before closing a ticket as a duplicate, would you mind pointing out which ticket this is a duplicate of?
comment:5 Changed 16 years ago by cmlenz
- Resolution set to fixed
- Status changed from reopened to closed
comment:6 Changed 15 years ago by cmlenz
- Milestone changed from 0.5.2 to 0.6
Milestone 0.5.2 deleted
Note: See
TracTickets for help on using
tickets.
Replying to kjkuan@…: