From 9e3f80503cecccfd557acbd29d39cefbd15e918b Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 5 Mar 2007 18:19:04 +0100 Subject: [PATCH] [svn] fix for misunderstood problem for #217 --HG-- branch : trunk --- jinja/translators/python.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- 2.26.2