Permalink
Browse files

Added improved documentation to the `ContextReference` node.

--HG--
branch : trunk
  • Loading branch information...
1 parent 0dbaf39 commit cedb482ad13998307959d650efe85fe7dff2845d @mitsuhiko mitsuhiko committed Mar 24, 2010
Showing with 10 additions and 1 deletion.
  1. +10 −1 jinja2/nodes.py
View
@@ -821,7 +821,16 @@ def as_const(self, eval_ctx=None):
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):

0 comments on commit cedb482

Please sign in to comment.