From: Armin Ronacher Date: Fri, 1 Jun 2007 10:54:40 +0000 (+0200) Subject: [svn] fixed extended slicing X-Git-Tag: 2.0rc1~303 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2f613d01d2e87c2ba139aa1271936629084f25bc;p=jinja2.git [svn] fixed extended slicing --HG-- branch : trunk --- diff --git a/jinja/translators/python.py b/jinja/translators/python.py index ddd9e54..34ae77c 100644 --- a/jinja/translators/python.py +++ b/jinja/translators/python.py @@ -1007,7 +1007,7 @@ class PythonTranslator(Translator): node.filename) assert node.flags != 'OP_DELETE', 'wtf? do we support that?' if node.subs[0].__class__ is ast.Sliceobj: - return '%s[%s]' % ( + return '%s%s' % ( self.handle_node(node.expr), self.handle_node(node.subs[0]) ) diff --git a/tests/test_various.py b/tests/test_various.py index a4c148a..6f449a4 100644 --- a/tests/test_various.py +++ b/tests/test_various.py @@ -28,15 +28,19 @@ KEYWORDS = '''\ {{ while }} {{ pass }} {{ finally }}''' +LIGHTKW = '''{{ call }}''' UNPACKING = '''{% for a, b, c in [[1, 2, 3]] %}{{ a }}|{{ b }}|{{ c }}{% endfor %}''' RAW = '''{% raw %}{{ FOO }} and {% BAR %}{% endraw %}''' CALL = '''{{ foo('a', c='d', e='f', *['b'], **{'g': 'h'}) }}''' - def test_keywords(env): env.from_string(KEYWORDS) +def test_lightkw(env): + env.from_string(LIGHTKW) + + def test_unpacking(env): tmpl = env.from_string(UNPACKING) assert tmpl.render() == '1|2|3'