From e2244881cd7f57c4436095e54675fb1da9446d8d Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 19 May 2008 09:25:57 +0200 Subject: [PATCH] improved thread safety of the LRUCache and fixed a bug in for loops --HG-- branch : trunk --- docs/switching.rst | 4 ++++ docs/tricks.rst | 19 +++++++++++++++++++ jinja2/compiler.py | 41 +++++++++++++++++------------------------ jinja2/utils.py | 4 ++-- 4 files changed, 42 insertions(+), 26 deletions(-) diff --git a/docs/switching.rst b/docs/switching.rst index 98303fe..f521f08 100644 --- a/docs/switching.rst +++ b/docs/switching.rst @@ -79,6 +79,10 @@ instead. Includes no longer import macros and variable assignments, for that the new `import` tag is used. This concept is explained in the :ref:`import` documentation. +Another small change happened in the `for`-tag. The special loop variable +doesn't have a `parent` attribute, instead you have to alias the loop +yourself. See :ref:`accessing-the-parent-loop` for more details. + Django ------ diff --git a/docs/tricks.rst b/docs/tricks.rst index 051c6fa..566575e 100644 --- a/docs/tricks.rst +++ b/docs/tricks.rst @@ -79,3 +79,22 @@ sense to defined a default for that variable:: {% endfor %} ... + +.. _accessing-the-parent-loop: + +Accessing the parent Loop +------------------------- + +The special `loop` variable always points to the innermost loop. If it's +desired to have access to an outer loop it's possible to alias it:: + + + {% for row in table %} + + {% set rowloop = loop %} + {% for cell in row %} +