From: Armin Ronacher Date: Mon, 5 Mar 2007 17:19:04 +0000 (+0100) Subject: [svn] fix for misunderstood problem for #217 X-Git-Tag: 2.0rc1~462 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9e3f80503cecccfd557acbd29d39cefbd15e918b;p=jinja2.git [svn] fix for misunderstood problem for #217 --HG-- branch : trunk --- diff --git a/jinja/translators/python.py b/jinja/translators/python.py index 4625fff..be8eb3a 100644 --- a/jinja/translators/python.py +++ b/jinja/translators/python.py @@ -273,6 +273,8 @@ class PythonTranslator(Translator): if node.recursive: write('def forloop(seq):') self.indention += 1 + write('loopbuffer = []') + write('write = loopbuffer.append') write('context[\'loop\'].push(seq)') write('for %s in context[\'loop\']:' % self.handle_node(node.item), @@ -301,9 +303,10 @@ class PythonTranslator(Translator): # call recursive for loop! if node.recursive: write('context[\'loop\'].pop()') + write('return u\'\'.join(buffer)') self.indention -= 1 write('context[\'loop\'] = LoopContext(None, context[\'loop\'], forloop)') - write('forloop(%s)' % self.handle_node(node.seq)) + write('write(forloop(%s))' % self.handle_node(node.seq)) write('context.pop()') return '\n'.join(buf)