Skip to content
Myr

[svn] fixed extended slicing

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent fd4e181 · Browse files · 2 files+6 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+6 added−2 removed

  • tests:+5 added−1 removed
  • other:+1 added−1 removed

2 files+6 added−2 removed

modified:jinja/translators/python.py+1 added-1 removed
1005 unmodified lines
1006 node.lineno,1007 node.filename)1008 assert node.flags != 'OP_DELETE', 'wtf? do we support that?'1009 if node.subs[0].__class__ is ast.Sliceobj:1010 return '%s[%s]' % (1010 return '%s%s' % (1011 self.handle_node(node.expr),1012 self.handle_node(node.subs[0])1013 )1014 self.used_shortcuts.add('get_attribute')
201 unmodified lines
modified:tests/test_various.py+5 added-1 removed
26 unmodified lines
27{{ yield }}28{{ while }}29{{ pass }}30{{ finally }}'''31LIGHTKW = '''{{ call }}'''32UNPACKING = '''{% for a, b, c in [[1, 2, 3]] %}{{ a }}|{{ b }}|{{ c }}{% endfor %}'''33RAW = '''{% raw %}{{ FOO }} and {% BAR %}{% endraw %}'''34CALL = '''{{ foo('a', c='d', e='f', *['b'], **{'g': 'h'}) }}'''353536def test_keywords(env):37 env.from_string(KEYWORDS)383940def test_lightkw(env):41 env.from_string(LIGHTKW)424344def test_unpacking(env):45 tmpl = env.from_string(UNPACKING)46 assert tmpl.render() == '1|2|3'47
43 unmodified lines