Skip to content
This repository
Browse code

Added improved documentation to the `ContextReference` node.

--HG--
branch : trunk
  • Loading branch information...
commit cedb482ad13998307959d650efe85fe7dff2845d 1 parent 0dbaf39
Armin Ronacher authored

Showing 1 changed file with 10 additions and 1 deletion. Show diff stats Hide diff stats

  1. 11  jinja2/nodes.py
11  jinja2/nodes.py
@@ -821,7 +821,16 @@ def as_const(self, eval_ctx=None):
821 821
 
822 822
 
823 823
 class ContextReference(Expr):
824  
-    """Returns the current template context."""
  824
+    """Returns the current template context.  It can be used like a
  825
+    :class:`Name` node, with a ``'load'`` ctx and will return the
  826
+    current :class:`~jinja2.runtime.Context` object.
  827
+
  828
+    Here an example that assigns the current template name to a
  829
+    variable named `foo`::
  830
+
  831
+        Assign(Name('foo', ctx='store'),
  832
+               Getattr(ContextReference(), 'name'))
  833
+    """
825 834
 
826 835
 
827 836
 class Continue(Stmt):

0 notes on commit cedb482

Please sign in to comment.
Something went wrong with that request. Please try again.