Fixed a testcase for Python 2.4
authorArmin Ronacher <armin.ronacher@active-4.com>
Sun, 14 Mar 2010 23:48:46 +0000 (00:48 +0100)
committerArmin Ronacher <armin.ronacher@active-4.com>
Sun, 14 Mar 2010 23:48:46 +0000 (00:48 +0100)
--HG--
branch : trunk

jinja2/compiler.py

index 3bc6d354fee587df6d49690751b642b44669fc55..2952b66e454cd8f9c9aa562ddca659cd03e15519 100644 (file)
@@ -439,15 +439,19 @@ class CodeGenerator(NodeVisitor):
 
     def return_buffer_contents(self, frame):
         """Return the buffer contents of the frame."""
-        self.writeline('return ')
         if frame.eval_ctx.volatile:
-            self.write('(Markup(concat(%s)) if context.eval_ctx'
-                       '.autoescape else concat(%s))' %
-                       (frame.buffer, frame.buffer))
+            self.writeline('if context.eval_ctx.autoescape:')
+            self.indent()
+            self.writeline('return Markup(concat(%s))' % frame.buffer)
+            self.outdent()
+            self.writeline('else:')
+            self.indent()
+            self.writeline('return concat(%s)' % frame.buffer)
+            self.outdent()
         elif frame.eval_ctx.autoescape:
-            self.write('Markup(concat(%s))' % frame.buffer)
+            self.writeline('return Markup(concat(%s))' % frame.buffer)
         else:
-            self.write('concat(%s)' % frame.buffer)
+            self.writeline('return concat(%s)' % frame.buffer)
 
     def indent(self):
         """Indent by one."""