#2102 closed enhancement (fixed)
[patch] Enable the template for loop to work with a generator.
Description ¶
The template system's for loop currently doesn't work with a generator because the length of the iterable is required for the variables forloop.revcounter, forloop.revcounter0 and forloop.last.
This patch simply checks for a len attribute on the iterable. If it doesn't exist, a list is created from the iterable and used in its place.
Change History (3)
by , 19 years ago
Attachment: | for_loop_with_generator.diff added |
---|
comment:1 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 16 years ago
Note:
See TracTickets
for help on using tickets.
(In [3165]) Fixed #2102 -- Template system 'for' loops now support generators. Thanks, dbm-django@…