Jinja2 Changelog
================
-Version 2.2
------------
-(codename to be selected, release date yet unknown)
+Version 2.1.1
+-------------
+(Bugfix release)
+
+- Fixed a translation error caused by looping over empty recursive loops.
Version 2.1
-----------
"""Return a human readable position for the node."""
rv = 'line %d' % node.lineno
if self.name is not None:
- rv += ' in' + repr(self.name)
+ rv += ' in ' + repr(self.name)
return rv
# -- Statement Visitors
self.outdent()
# reset the aliases if there are any.
- self.pop_scope(aliases, loop_frame)
+ if not node.recursive:
+ self.pop_scope(aliases, loop_frame)
# if the node was recursive we have to return the buffer contents
# and start the iteration code
t = env.from_string('{% for x in seq %}{% for y in seq %}'
'{{ loop.first }}{% endfor %}{% endfor %}')
assert t.render(seq='ab') == 'TrueFalseTrueFalse'
+
+
+def test_recursive_empty_loop_iter(env):
+ t = env.from_string('''
+ {%- for item in foo recursive -%}{%- endfor -%}
+ ''')
+ assert t.render(dict(foo=[])) == ''