Skip to content
Myr

Added docs for policies

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

authored by Armin Ronacher · committed by Armin Ronacher · parent 47b55f8 · Browse files · 1 file+29 added−0 removed
This commit

State

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

Diff stats

1 file+29 added−0 removed

  • other:+29 added−0 removed

1 file+29 added−0 removed

modified:docs/api.rst+29 added
152 unmodified lines
153 in a template. As long as no template was loaded it's safe154 to modify this dict. For more details see :ref:`global-namespace`.155 For valid object names have a look at :ref:`identifier-naming`.156157 .. attribute:: policies158159 A dictionary with :ref:`policies`. These can be reconfigured to160 change the runtime behavior or certain template features. Usually161 these are security related.162163 .. attribute:: code_generator_class164165 The class used for code generation. This should not be changed166 in most cases, unless you need to modify the Python code a
374 unmodified lines
541avaitable object then this would not result in the expected behavior.542543Likewise iterations with a `for` loop support async iterators.544545.. _policies:546547Policies548--------549550Starting with Jinja 2.9 policies can be configured on the environment551which can slightly influence how filters and other template constructs552behave. They can be configured with the553:attr:`~jinja2.Environment.policies` attribute.554555Example::556557 env.policies['urlize.rel'] = 'nofollow noopener'558559``urlize.rel``:560 A string that defines the items for the `rel` attribute of generated561 links with the `urlize` filter. These items are always added. The562 default is `noopener`.563564``urlize.target``:565 The default target that is issued for links from the `urlize` filter566 if no other target is defined by the call explicitly.567568569Utilities570---------571572These helper functions and classes are useful if you add custom filters or
305 unmodified lines