Ticket #13608: 13608.diff

File 13608.diff, 1.4 KB (added by Derek Willis, 14 years ago)
  • docs/ref/templates/api.txt

    From 41779291b8a4cd91e1fa5914dbebc96cd8cb7d20 Mon Sep 17 00:00:00 2001
    From: Derek Willis <dwillis@gmail.com>
    Date: Fri, 24 Sep 2010 17:24:31 -0400
    Subject: [PATCH] clarified list-index lookup for dot notations
    
    ---
     docs/ref/templates/api.txt |    3 ++-
     docs/topics/templates.txt  |    4 ++--
     2 files changed, 4 insertions(+), 3 deletions(-)
    
    diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt
    index 2ac4e65..207baf6 100644
    a b in a variable name, it tries the following lookups, in this order:  
    120120    * List-index lookup. Example: ``foo[bar]``
    121121
    122122The template system uses the first lookup type that works. It's short-circuit
    123 logic.
     123logic. Note that the final lookup type, the list-index, will not work if ``bar``
     124is a string; it only works if ``bar`` is an integer.
    124125
    125126Here are a few examples::
    126127
  • docs/topics/templates.txt

    diff --git a/docs/topics/templates.txt b/docs/topics/templates.txt
    index c3fdd2c..6bfbcdf 100644
    a b Use a dot (``.``) to access attributes of a variable.  
    9595        * Dictionary lookup
    9696        * Attribute lookup
    9797        * Method call
    98         * List-index lookup
    99 
     98        * List-index lookup (only works if the attribute is an integer)
     99       
    100100In the above example, ``{{ section.title }}`` will be replaced with the
    101101``title`` attribute of the ``section`` object.
    102102
Back to Top