From cedb482ad13998307959d650efe85fe7dff2845d Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Wed, 24 Mar 2010 10:53:22 +0100 Subject: [PATCH] Added improved documentation to the `ContextReference` node. --HG-- branch : trunk --- jinja2/nodes.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/jinja2/nodes.py b/jinja2/nodes.py index 6720fb1..15461e8 100644 --- a/jinja2/nodes.py +++ b/jinja2/nodes.py @@ -821,7 +821,16 @@ class MarkSafe(Expr): class ContextReference(Expr): - """Returns the current template context.""" + """Returns the current template context. It can be used like a + :class:`Name` node, with a ``'load'`` ctx and will return the + current :class:`~jinja2.runtime.Context` object. + + Here an example that assigns the current template name to a + variable named `foo`:: + + Assign(Name('foo', ctx='store'), + Getattr(ContextReference(), 'name')) + """ class Continue(Stmt): -- 2.26.2