It's now possible to use ``{{ foo.0.0 }}``
authorArmin Ronacher <armin.ronacher@active-4.com>
Wed, 10 Sep 2008 12:03:53 +0000 (14:03 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Wed, 10 Sep 2008 12:03:53 +0000 (14:03 +0200)
--HG--
branch : trunk

CHANGES
jinja2/lexer.py
tests/test_syntax.py

diff --git a/CHANGES b/CHANGES
index 23ad978cecad887f9d3b01cffb05636c81232e4a..c1eb7334eae4bd84b2eb427030b1a132c35b4904 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -12,6 +12,8 @@ Version 2.1
 - fixed a bug with the i18n extension that caused the explicit pluralization
   block to look up the wrong variable.
 
+- fixed a limitation in the lexer that made ``{{ foo.0.0 }}`` impossible.
+
 Version 2.0
 -----------
 (codename jinjavitus, released on July 17th 2008)
index 9702205df7309374a5279437d9563846bb76c324..14b7110e43a14fdc42de35dd962b8d832bdff4b4 100644 (file)
@@ -31,7 +31,7 @@ string_re = re.compile(r"('([^'\\]*(?:\\.[^'\\]*)*)'"
                        r'|"([^"\\]*(?:\\.[^"\\]*)*)")', re.S)
 integer_re = re.compile(r'\d+')
 name_re = re.compile(r'\b[a-zA-Z_][a-zA-Z0-9_]*\b')
-float_re = re.compile(r'\d+\.\d+')
+float_re = re.compile(r'(?<!\.)\d+\.\d+')
 newline_re = re.compile(r'(\r\n|\r|\n)')
 
 # bind operators to token types
index 29b3974e3225cc718cfcbcf988b7d409b9825374..157720ff958bf00852a11774ba8b3fc76bb16b39 100644 (file)
@@ -26,7 +26,7 @@ LITERALS = '''{{ [] }}|{{ {} }}|{{ () }}'''
 BOOL = '''{{ true and false }}|{{ false or true }}|{{ not false }}'''
 GROUPING = '''{{ (true and false) or (false and true) and not false }}'''
 CONDEXPR = '''{{ 0 if true else 1 }}'''
-DJANGOATTR = '''{{ [1, 2, 3].0 }}'''
+DJANGOATTR = '''{{ [1, 2, 3].0 }}|{{ [[1]].0.0 }}'''
 FILTERPRIORITY = '''{{ "foo"|upper + "bar"|upper }}'''
 TUPLETEMPLATES = [
     '{{ () }}',
@@ -116,7 +116,7 @@ def test_grouping(env):
 
 def test_django_attr(env):
     tmpl = env.from_string(DJANGOATTR)
-    assert tmpl.render() == '1'
+    assert tmpl.render() == '1|1'
 
 
 def test_conditional_expression(env):