Fixed #2102 -- Template system 'for' loops now support generators. Thanks, dbm-django@mclachlan.com.au

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3165 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-06-20 03:58:16 +00:00
parent 136752ca9a
commit 6b730e1e92
1 changed files with 2 additions and 0 deletions

View File

@ -88,6 +88,8 @@ class ForNode(Node):
values = []
if values is None:
values = []
if not hasattr(values, '__len__'):
values = list(values)
len_values = len(values)
if self.reversed:
# From http://www.python.org/doc/current/tut/node11.html