diff options
author | Adrian Holovaty <adrian@holovaty.com> | 2006-06-20 03:58:16 +0000 |
---|---|---|
committer | Adrian Holovaty <adrian@holovaty.com> | 2006-06-20 03:58:16 +0000 |
commit | 6b730e1e92eb85beb3d3f7401ee5dce50895d758 (patch) | |
tree | 3515e7cdcb47bff90c0e7d2c56c39e5d3b68b160 | |
parent | 136752ca9a87be908f9ec1e398bbd56b0c75222c (diff) | |
download | django-6b730e1e92eb85beb3d3f7401ee5dce50895d758.tar.gz |
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
-rw-r--r-- | django/template/defaulttags.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 8b52b70cda..88cb5f68be 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -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 |