From: Armin Ronacher Date: Sun, 14 Mar 2010 23:48:46 +0000 (+0100) Subject: Fixed a testcase for Python 2.4 X-Git-Tag: 2.4~16 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f3c66d92523aa2760d6f904bf4ec56017fb363c6;p=jinja2.git Fixed a testcase for Python 2.4 --HG-- branch : trunk --- diff --git a/jinja2/compiler.py b/jinja2/compiler.py index 3bc6d35..2952b66 100644 --- a/jinja2/compiler.py +++ b/jinja2/compiler.py @@ -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."""