diff options
| author | Baptiste Mispelon <bmispelon@gmail.com> | 2014-07-29 10:54:11 +0200 |
|---|---|---|
| committer | Baptiste Mispelon <bmispelon@gmail.com> | 2014-07-29 11:00:19 +0200 |
| commit | 13d44f54a265e9fc6185e1d5518da8ad568fbaad (patch) | |
| tree | 86c943855052c3ce7c5dd081f71629cab804c292 /docs | |
| parent | 394053ce605a30c742d6270a80986b255adb3a30 (diff) | |
[1.7.x] Fixed #23114 -- Clarified documentation of template lookups.
Thanks to gmunumel and Tom Dalton for their help on the patch.
Backport of 62c74abbb06a081708c2cb5cc459f39beb26acaa from master.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/templates.txt | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/docs/topics/templates.txt b/docs/topics/templates.txt index 92114aebe5..e50e7c96f7 100644 --- a/docs/topics/templates.txt +++ b/docs/topics/templates.txt @@ -95,13 +95,15 @@ Use a dot (``.``) to access attributes of a variable. following lookups, in this order: * Dictionary lookup - * Attribute lookup - * Method call - * List-index lookup + * Attribute or method lookup + * Numeric index lookup - This can cause some unexpected behavior with objects that override - dictionary lookup. For example, consider the following code snippet that - attempts to loop over a ``collections.defaultdict``:: + If the resulting value is callable, it is called with no arguments. The + result of the call becomes the template value. + + This lookup order can cause some unexpected behavior with objects that + override dictionary lookup. For example, consider the following code snippet + that attempts to loop over a ``collections.defaultdict``:: {% for k, v in defaultdict.iteritems %} Do something with k and v here... |
