Skip to content
Myr

More documentation updates.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent e3faeb5 · Browse files · 2 files+26 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+26 added−3 removed

  • other:+26 added−3 removed

2 files+26 added−3 removed

modified:docs/api.rst+12 added
625 unmodified lines
626must only happen with a :class:`nodes.EvalContextModifier` and627:class:`nodes.ScopedEvalContextModifier` from an extension, not on the628eval context object itself.629630.. autoclass:: nodes.EvalContext631632 .. attribute:: autoescape633634 `True` or `False` depending on if autoescaping is active or not.635636 .. attribute:: volatile637638 `True` if the compiler cannot evaluate some expressions at compile639 time. At runtime this should always be `False`.640641642.. _writing-tests:643644Custom Tests645------------
110 unmodified lines
modified:jinja2/nodes.py+14 added-3 removed
66 unmodified lines
67 return type.__new__(cls, name, bases, d)686970class EvalContext(object):71 """Holds evaluation time information"""71 """Holds evaluation time information. Custom attributes can be attached72 to it in extensions.73 """7475 def __init__(self, environment):76 self.autoescape = environment.autoescape77 self.volatile = False
759 unmodified lines
837 fields = ('body',)838839840class EvalContextModifier(Stmt):839 """Modifies the eval context"""841 """Modifies the eval context. For each option that should be modified,842 a :class:`Keyword` has to be added to the :attr:`options` list.843844 Example to change the `autoescape` setting::845846 EvalContextModifier(options=[Keyword('autoescape', Const(True))])847 """848 fields = ('options',)849850851class ScopedEvalContextModifier(EvalContextModifier):844 """Modifies the eval context and reverts it later."""852 """Modifies the eval context and reverts it later. Works exactly like853 :class:`EvalContextModifier` but will only modify the854 :class:`EvalContext` for nodes in the :attr:`body`.855 """856 fields = ('body',)857858859# make sure nobody creates custom nodes
3 unmodified lines