Skip to content
Myr

It's now possible to use ``{{ foo.0.0 }}``

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 f7e405d · Browse files · 3 files+5 added−3 removed
This commit

State

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

Diff stats

3 files+5 added−3 removed

  • tests:+2 added−2 removed
  • other:+3 added−1 removed

3 files+5 added−3 removed

modified:jinja2/lexer.py+1 added-1 removed
29 unmodified lines
30string_re = re.compile(r"('([^'\\]*(?:\\.[^'\\]*)*)'"31 r'|"([^"\\]*(?:\\.[^"\\]*)*)")', re.S)32integer_re = re.compile(r'\d+')33name_re = re.compile(r'\b[a-zA-Z_][a-zA-Z0-9_]*\b')34float_re = re.compile(r'\d+\.\d+')34float_re = re.compile(r'(?<!\.)\d+\.\d+')35newline_re = re.compile(r'(\r\n|\r|\n)')3637# bind operators to token types38operators = {
518 unmodified lines
modified:tests/test_syntax.py+2 added-2 removed
24 unmodified lines
25LITERALS = '''{{ [] }}|{{ {} }}|{{ () }}'''26BOOL = '''{{ true and false }}|{{ false or true }}|{{ not false }}'''27GROUPING = '''{{ (true and false) or (false and true) and not false }}'''28CONDEXPR = '''{{ 0 if true else 1 }}'''29DJANGOATTR = '''{{ [1, 2, 3].0 }}'''29DJANGOATTR = '''{{ [1, 2, 3].0 }}|{{ [[1]].0.0 }}'''30FILTERPRIORITY = '''{{ "foo"|upper + "bar"|upper }}'''31TUPLETEMPLATES = [32 '{{ () }}',33 '{{ (1, 2) }}',
81 unmodified lines
115116117def test_django_attr(env):118 tmpl = env.from_string(DJANGOATTR)119 assert tmpl.render() == '1'119 assert tmpl.render() == '1|1'120121122def test_conditional_expression(env):123 tmpl = env.from_string(CONDEXPR)
68 unmodified lines
modified:CHANGES+2 added
10 unmodified lines
1112- fixed a bug with the i18n extension that caused the explicit pluralization13 block to look up the wrong variable.1415- fixed a limitation in the lexer that made ``{{ foo.0.0 }}`` impossible.1617Version 2.018-----------19(codename jinjavitus, released on July 17th 2008)20
32 unmodified lines