From: Armin Ronacher Date: Mon, 26 Feb 2007 21:32:20 +0000 (+0100) Subject: [svn] added better test.py file for jinja1 and fixed python translator bug X-Git-Tag: 2.0rc1~491 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=eb1fbdffa1fc8c1ae2015be97fac2168b6a89173;p=jinja2.git [svn] added better test.py file for jinja1 and fixed python translator bug --HG-- branch : trunk --- diff --git a/jinja/translators/python.py b/jinja/translators/python.py index 927f892..57028d8 100644 --- a/jinja/translators/python.py +++ b/jinja/translators/python.py @@ -201,9 +201,9 @@ class PythonTranslator(object): """ We use the pipe operator for filtering. """ - return 'environment.apply_filters(%s, %r)' % ( + return 'environment.apply_filters(%s, [%s])' % ( self.handle_node(node.nodes[0]), - [self.handle_node(n) for n in node.nodes[1:]] + ', '.join([self.handle_node(n) for n in node.nodes[1:]]) ) def handle_call_func(self, node): diff --git a/test.py b/test.py index e090dac..8ce99bc 100644 --- a/test.py +++ b/test.py @@ -2,6 +2,12 @@ from jinja.environment import Environment e = Environment() -def test(x): +def test_lexer(x): for pos, token, data in e.lexer.tokenize(x): print '%-8d%-30r%-40r' % (pos, token, data) + + +def test_parser(x): + from jinja.parser import Parser + from jinja.translators.python import translate + print translate(e, Parser(e, x).parse())