--- /tmp/jinja2-3.0.1-2zufmuu8m/debian/python-jinja2-doc_3.0.1-2_all.deb +++ python-jinja2-doc_3.0.1-2_all.deb ├── file list │ @@ -1,3 +1,3 @@ │ -rw-r--r-- 0 0 0 4 2021-10-01 09:22:02.000000 debian-binary │ --rw-r--r-- 0 0 0 2144 2021-10-01 09:22:02.000000 control.tar.xz │ --rw-r--r-- 0 0 0 185840 2021-10-01 09:22:02.000000 data.tar.xz │ +-rw-r--r-- 0 0 0 2148 2021-10-01 09:22:02.000000 control.tar.xz │ +-rw-r--r-- 0 0 0 185848 2021-10-01 09:22:02.000000 data.tar.xz ├── control.tar.xz │ ├── control.tar │ │ ├── ./md5sums │ │ │ ├── ./md5sums │ │ │ │┄ Files differ ├── data.tar.xz │ ├── data.tar │ │ ├── file list │ │ │ @@ -45,31 +45,31 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 12854 2019-10-14 14:13:12.000000 ./usr/share/doc/python-jinja2-doc/html/_static/jinja-logo.png │ │ │ -rw-r--r-- 0 root (0) root (0) 338 2020-01-08 16:14:49.000000 ./usr/share/doc/python-jinja2-doc/html/_static/jinja.css │ │ │ -rw-r--r-- 0 root (0) root (0) 90 2021-01-01 06:53:29.000000 ./usr/share/doc/python-jinja2-doc/html/_static/minus.png │ │ │ -rw-r--r-- 0 root (0) root (0) 90 2021-01-01 06:53:29.000000 ./usr/share/doc/python-jinja2-doc/html/_static/plus.png │ │ │ -rw-r--r-- 0 root (0) root (0) 7436 2020-01-02 15:00:40.000000 ./usr/share/doc/python-jinja2-doc/html/_static/pocoo.css │ │ │ -rw-r--r-- 0 root (0) root (0) 4150 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/_static/pygments.css │ │ │ -rw-r--r-- 0 root (0) root (0) 1582 2020-01-02 15:00:40.000000 ./usr/share/doc/python-jinja2-doc/html/_static/version_warning_offset.js │ │ │ --rw-r--r-- 0 root (0) root (0) 281850 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/api.html │ │ │ --rw-r--r-- 0 root (0) root (0) 83215 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/changes.html │ │ │ --rw-r--r-- 0 root (0) root (0) 221842 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/extensions.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 282082 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/api.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 83218 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/changes.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 221974 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/extensions.html │ │ │ -rw-r--r-- 0 root (0) root (0) 17189 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/faq.html │ │ │ -rw-r--r-- 0 root (0) root (0) 48233 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/genindex.html │ │ │ -rw-r--r-- 0 root (0) root (0) 17664 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/index.html │ │ │ -rw-r--r-- 0 root (0) root (0) 9084 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/integration.html │ │ │ -rw-r--r-- 0 root (0) root (0) 6685 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/intro.html │ │ │ -rw-r--r-- 0 root (0) root (0) 5279 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/license.html │ │ │ --rw-r--r-- 0 root (0) root (0) 23393 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/nativetypes.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 23431 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/nativetypes.html │ │ │ -rw-r--r-- 0 root (0) root (0) 3629 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/objects.inv │ │ │ -rw-r--r-- 0 root (0) root (0) 4327 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/py-modindex.html │ │ │ --rw-r--r-- 0 root (0) root (0) 36686 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/sandbox.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 36703 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/sandbox.html │ │ │ -rw-r--r-- 0 root (0) root (0) 3313 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/search.html │ │ │ -rw-r--r-- 0 root (0) root (0) 43221 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/searchindex.js │ │ │ -rw-r--r-- 0 root (0) root (0) 21148 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/switching.html │ │ │ --rw-r--r-- 0 root (0) root (0) 351800 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/templates.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 351903 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/templates.html │ │ │ -rw-r--r-- 0 root (0) root (0) 14805 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/tricks.html │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2021-10-01 09:22:02.000000 ./usr/share/doc/python3-jinja2/ │ │ │ lrwxrwxrwx 0 root (0) root (0) 0 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2/html -> ../python-jinja2-doc/html │ │ │ lrwxrwxrwx 0 root (0) root (0) 0 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2/rst -> ../python-jinja2-doc/html/_sources │ │ │ lrwxrwxrwx 0 root (0) root (0) 0 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/_static/doctools.js -> ../../../../javascript/sphinxdoc/1.0/doctools.js │ │ │ lrwxrwxrwx 0 root (0) root (0) 0 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/_static/jquery.js -> ../../../../javascript/sphinxdoc/1.0/jquery.js │ │ │ lrwxrwxrwx 0 root (0) root (0) 0 2021-10-01 09:22:02.000000 ./usr/share/doc/python-jinja2-doc/html/_static/language_data.js -> ../../../../javascript/sphinxdoc/1.0/language_data.js │ │ ├── ./usr/share/doc/python-jinja2-doc/html/api.html │ │ │ @@ -209,36 +209,36 @@ │ │ │ allows using async functions and generators.

│ │ │ │ │ │ │ │ │ │ │ │
│ │ │
Parameters
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ shared
│ │ │

If a template was created by using the Template constructor │ │ │ @@ -319,32 +319,32 @@ │ │ │

Creating overlays should happen after the initial environment was set │ │ │ up completely. Not all attributes are truly linked, some are just │ │ │ copied over so modifications on the original environment may not shine │ │ │ through.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • block_start_string (str) –

  • │ │ │ -
  • block_end_string (str) –

  • │ │ │ -
  • variable_start_string (str) –

  • │ │ │ -
  • variable_end_string (str) –

  • │ │ │ -
  • comment_start_string (str) –

  • │ │ │ -
  • comment_end_string (str) –

  • │ │ │ -
  • line_statement_prefix (Optional[str]) –

  • │ │ │ -
  • line_comment_prefix (Optional[str]) –

  • │ │ │ -
  • trim_blocks (bool) –

  • │ │ │ -
  • lstrip_blocks (bool) –

  • │ │ │ -
  • extensions (Sequence[Union[str, Type[Extension]]]) –

  • │ │ │ -
  • optimized (bool) –

  • │ │ │ +
  • block_start_string (str) –

  • │ │ │ +
  • block_end_string (str) –

  • │ │ │ +
  • variable_start_string (str) –

  • │ │ │ +
  • variable_end_string (str) –

  • │ │ │ +
  • comment_start_string (str) –

  • │ │ │ +
  • comment_end_string (str) –

  • │ │ │ +
  • line_statement_prefix (Optional[str]) –

  • │ │ │ +
  • line_comment_prefix (Optional[str]) –

  • │ │ │ +
  • trim_blocks (bool) –

  • │ │ │ +
  • lstrip_blocks (bool) –

  • │ │ │ +
  • extensions (Sequence[Union[str, Type[Extension]]]) –

  • │ │ │ +
  • optimized (bool) –

  • │ │ │
  • undefined (Type[jinja2.runtime.Undefined]) –

  • │ │ │
  • finalize (Optional[Callable[[...], Any]]) –

  • │ │ │ -
  • autoescape (Union[bool, Callable[[Optional[str]], bool]]) –

  • │ │ │ +
  • autoescape (Union[bool, Callable[[Optional[str]], bool]]) –

  • │ │ │
  • loader (Optional[BaseLoader]) –

  • │ │ │ -
  • cache_size (int) –

  • │ │ │ -
  • auto_reload (bool) –

  • │ │ │ +
  • cache_size (int) –

  • │ │ │ +
  • auto_reload (bool) –

  • │ │ │
  • bytecode_cache (Optional[BytecodeCache]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

Environment

│ │ │
│ │ │
│ │ │ @@ -391,18 +391,18 @@ │ │ │ add_extension(extension) │ │ │

Adds an extension after the environment was created.

│ │ │
│ │ │

New in version 2.5.

│ │ │
│ │ │
│ │ │
Parameters
│ │ │ -

extension (Union[str, Type[Extension]]) –

│ │ │ +

extension (Union[str, Type[Extension]]) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ compile_expression(source, undefined_to_none=True)
│ │ │ @@ -431,16 +431,16 @@ │ │ │ │ │ │
│ │ │

New in version 2.1.

│ │ │
│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • source (str) –

  • │ │ │ -
  • undefined_to_none (bool) –

  • │ │ │ +
  • source (str) –

  • │ │ │ +
  • undefined_to_none (bool) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

jinja2.environment.TemplateExpression

│ │ │
│ │ │
│ │ │
│ │ │ @@ -462,24 +462,24 @@ │ │ │ to False and you will get an exception on syntax errors.

│ │ │
│ │ │

New in version 2.4.

│ │ │
│ │ │
│ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ extend(**attributes)
│ │ │ @@ -487,29 +487,29 @@ │ │ │ yet. This is used by extensions to register │ │ │ callbacks and configuration values without breaking inheritance.

│ │ │
│ │ │
Parameters
│ │ │

attributes (Any) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ from_string(source, globals=None, template_class=None)
│ │ │

Load a template from a source string without using │ │ │ loader.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • source (Union[str, jinja2.nodes.Template]) – Jinja source to compile into a template.

  • │ │ │ -
  • globals (Optional[Mapping[str, Any]]) – Extend the environment globals with │ │ │ +

  • source (Union[str, jinja2.nodes.Template]) – Jinja source to compile into a template.

  • │ │ │ +
  • globals (Optional[Mapping[str, Any]]) – Extend the environment globals with │ │ │ these extra variables available for all renders of this │ │ │ template. If the template has already been loaded and │ │ │ cached, its globals are updated with any new items.

  • │ │ │
  • template_class (Optional[Type[jinja2.environment.Template]]) – Return an instance of this │ │ │ Template class.

  • │ │ │
│ │ │
│ │ │ @@ -526,17 +526,17 @@ │ │ │ is given, or get_template() if one name is given.

│ │ │
│ │ │

New in version 2.3.

│ │ │
│ │ │
│ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │

jinja2.environment.Template

│ │ │
│ │ │
│ │ │
│ │ │ @@ -546,19 +546,19 @@ │ │ │ get_template(name, parent=None, globals=None) │ │ │

Load a template by name with loader and return a │ │ │ Template. If the template does not exist a │ │ │ TemplateNotFound exception is raised.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • name (Union[str, jinja2.environment.Template]) – Name of the template to load.

  • │ │ │ -
  • parent (Optional[str]) – The name of the parent template importing this │ │ │ +

  • name (Union[str, jinja2.environment.Template]) – Name of the template to load.

  • │ │ │ +
  • parent (Optional[str]) – The name of the parent template importing this │ │ │ template. join_path() can be used to implement name │ │ │ transformations with this.

  • │ │ │ -
  • globals (Optional[Mapping[str, Any]]) – Extend the environment globals with │ │ │ +

  • globals (Optional[Mapping[str, Any]]) – Extend the environment globals with │ │ │ these extra variables available for all renders of this │ │ │ template. If the template has already been loaded and │ │ │ cached, its globals are updated with any new items.

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

jinja2.environment.Template

│ │ │ @@ -583,20 +583,20 @@ │ │ │ parent template, this function can be used to calculate the real │ │ │ template name.

│ │ │

Subclasses may override this method and implement template path │ │ │ joining here.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • template (str) –

  • │ │ │ -
  • parent (str) –

  • │ │ │ +
  • template (str) –

  • │ │ │ +
  • parent (str) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

str

│ │ │ +

str

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ list_templates(extensions=None, filter_func=None)
│ │ │ @@ -605,45 +605,45 @@ │ │ │ list_templates() method.

│ │ │

If there are other files in the template folder besides the │ │ │ actual templates, the returned list can be filtered. There are two │ │ │ ways: either extensions is set to a list of file extensions for │ │ │ templates, or a filter_func can be provided which is a callable that │ │ │ is passed a template name and should return True if it should end up │ │ │ in the result list.

│ │ │ -

If the loader does not support that, a TypeError is raised.

│ │ │ +

If the loader does not support that, a TypeError is raised.

│ │ │
│ │ │

New in version 2.4.

│ │ │
│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • extensions (Optional[Collection[str]]) –

  • │ │ │ -
  • filter_func (Optional[Callable[[str], bool]]) –

  • │ │ │ +
  • extensions (Optional[Collection[str]]) –

  • │ │ │ +
  • filter_func (Optional[Callable[[str], bool]]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

List[str]

│ │ │ +

List[str]

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ select_template(names, parent=None, globals=None)
│ │ │

Like get_template(), but tries loading multiple names. │ │ │ If none of the names can be loaded a TemplatesNotFound │ │ │ exception is raised.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • names (Iterable[Union[str, jinja2.environment.Template]]) – List of template names to try loading in order.

  • │ │ │ -
  • parent (Optional[str]) – The name of the parent template importing this │ │ │ +

  • names (Iterable[Union[str, jinja2.environment.Template]]) – List of template names to try loading in order.

  • │ │ │ +
  • parent (Optional[str]) – The name of the parent template importing this │ │ │ template. join_path() can be used to implement name │ │ │ transformations with this.

  • │ │ │ -
  • globals (Optional[Mapping[str, Any]]) – Extend the environment globals with │ │ │ +

  • globals (Optional[Mapping[str, Any]]) – Extend the environment globals with │ │ │ these extra variables available for all renders of this │ │ │ template. If the template has already been loaded and │ │ │ cached, its globals are updated with any new items.

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

jinja2.environment.Template

│ │ │ @@ -696,33 +696,33 @@ │ │ │ ... │ │ │ StopIteration │ │ │ │ │ │ │ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • source (Union[str, jinja2.nodes.Template]) –

  • │ │ │ -
  • block_start_string (str) –

  • │ │ │ -
  • block_end_string (str) –

  • │ │ │ -
  • variable_start_string (str) –

  • │ │ │ -
  • variable_end_string (str) –

  • │ │ │ -
  • comment_start_string (str) –

  • │ │ │ -
  • comment_end_string (str) –

  • │ │ │ -
  • line_statement_prefix (Optional[str]) –

  • │ │ │ -
  • line_comment_prefix (Optional[str]) –

  • │ │ │ -
  • trim_blocks (bool) –

  • │ │ │ -
  • lstrip_blocks (bool) –

  • │ │ │ +
  • source (Union[str, jinja2.nodes.Template]) –

  • │ │ │ +
  • block_start_string (str) –

  • │ │ │ +
  • block_end_string (str) –

  • │ │ │ +
  • variable_start_string (str) –

  • │ │ │ +
  • variable_end_string (str) –

  • │ │ │ +
  • comment_start_string (str) –

  • │ │ │ +
  • comment_end_string (str) –

  • │ │ │ +
  • line_statement_prefix (Optional[str]) –

  • │ │ │ +
  • line_comment_prefix (Optional[str]) –

  • │ │ │ +
  • trim_blocks (bool) –

  • │ │ │ +
  • lstrip_blocks (bool) –

  • │ │ │
  • newline_sequence (te.Literal['\n', '\r\n', '\r']) –

  • │ │ │ -
  • keep_trailing_newline (bool) –

  • │ │ │ -
  • extensions (Sequence[Union[str, Type[Extension]]]) –

  • │ │ │ -
  • optimized (bool) –

  • │ │ │ +
  • keep_trailing_newline (bool) –

  • │ │ │ +
  • extensions (Sequence[Union[str, Type[Extension]]]) –

  • │ │ │ +
  • optimized (bool) –

  • │ │ │
  • undefined (Type[jinja2.runtime.Undefined]) –

  • │ │ │
  • finalize (Optional[Callable[[...], Any]]) –

  • │ │ │ -
  • autoescape (Union[bool, Callable[[Optional[str]], bool]]) –

  • │ │ │ -
  • enable_async (bool) –

  • │ │ │ +
  • autoescape (Union[bool, Callable[[Optional[str]], bool]]) –

  • │ │ │ +
  • enable_async (bool) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

Any

│ │ │
│ │ │
│ │ │
│ │ │ @@ -770,15 +770,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • args (Any) –

  • │ │ │
  • kwargs (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

str

│ │ │ +

str

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ generate([context])
│ │ │ @@ -791,15 +791,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • args (Any) –

  • │ │ │
  • kwargs (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

Iterator[str]

│ │ │ +

Iterator[str]

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ stream([context])
│ │ │ @@ -832,15 +832,15 @@ │ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │ -

str

│ │ │ +

str

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ generate_async([context])
│ │ │ @@ -850,15 +850,15 @@ │ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │ -

AsyncIterator[str]

│ │ │ +

AsyncIterator[str]

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ make_module(vars=None, shared=False, locals=None)
│ │ │ @@ -866,17 +866,17 @@ │ │ │ without arguments but it will evaluate the template on every call │ │ │ rather than caching it. It’s also possible to provide │ │ │ a dict which is then used as context. The arguments are the same │ │ │ as for the new_context() method.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • vars (Optional[Dict[str, Any]]) –

  • │ │ │ -
  • shared (bool) –

  • │ │ │ -
  • locals (Optional[Mapping[str, Any]]) –

  • │ │ │ +
  • vars (Optional[Dict[str, Any]]) –

  • │ │ │ +
  • shared (bool) –

  • │ │ │ +
  • locals (Optional[Mapping[str, Any]]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

jinja2.environment.TemplateModule

│ │ │
│ │ │
│ │ │
│ │ │ @@ -907,27 +907,27 @@ │ │ │ Per default the output is unbuffered which means that for every unbuffered │ │ │ instruction in the template one string is yielded.

│ │ │

If buffering is enabled with a buffer size of 5, five items are combined │ │ │ into a new string. This is mainly useful if you are streaming │ │ │ big templates to a client via WSGI which flushes after each iteration.

│ │ │
│ │ │
Parameters
│ │ │ -

gen (Iterator[str]) –

│ │ │ +

gen (Iterator[str]) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ disable_buffering()
│ │ │

Disable the output buffering.

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ dump(fp, encoding=None, errors='strict')
│ │ │ @@ -937,35 +937,35 @@ │ │ │

Example usage:

│ │ │
Template('Hello {{ name }}!').stream(name='foo').dump('hello.html')
│ │ │  
│ │ │
│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • fp (Union[str, IO]) –

  • │ │ │ -
  • encoding (Optional[str]) –

  • │ │ │ -
  • errors (Optional[str]) –

  • │ │ │ +
  • fp (Union[str, IO]) –

  • │ │ │ +
  • encoding (Optional[str]) –

  • │ │ │ +
  • errors (Optional[str]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ enable_buffering(size=5)
│ │ │

Enable buffering. Buffer size items before yielding them.

│ │ │
│ │ │
Parameters
│ │ │ -

size (int) –

│ │ │ +

size (int) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1014,22 +1014,22 @@ │ │ │

For security reasons this function operates case insensitive.

│ │ │
│ │ │

New in version 2.9.

│ │ │
│ │ │
│ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │ -

Callable[[Optional[str]], bool]

│ │ │ +

Callable[[Optional[str]], bool]

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │

Here a recommended setup that enables autoescaping for templates ending │ │ │ in '.html', '.htm' and '.xml' and disabling it by default │ │ │ for all other extensions. You can use the select_autoescape() │ │ │ @@ -1090,22 +1090,22 @@ │ │ │ ... │ │ │ jinja2.exceptions.UndefinedError: 'foo' is undefined │ │ │ │ │ │ │ │ │

│ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ _undefined_hint
│ │ │

Either None or a string with the error message for the │ │ │ undefined object.

│ │ │ @@ -1159,22 +1159,22 @@ │ │ │ │ │ │
│ │ │

New in version 2.11.0.

│ │ │
│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • hint (Optional[str]) –

  • │ │ │ +
  • hint (Optional[str]) –

  • │ │ │
  • obj (Any) –

  • │ │ │ -
  • name (Optional[str]) –

  • │ │ │ +
  • name (Optional[str]) –

  • │ │ │
  • exc (Type[jinja2.exceptions.TemplateRuntimeError]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class jinja2.DebugUndefined
│ │ │ @@ -1189,22 +1189,22 @@ │ │ │ ... │ │ │ jinja2.exceptions.UndefinedError: 'foo' is undefined │ │ │ │ │ │ │ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • hint (Optional[str]) –

  • │ │ │ +
  • hint (Optional[str]) –

  • │ │ │
  • obj (Any) –

  • │ │ │ -
  • name (Optional[str]) –

  • │ │ │ +
  • name (Optional[str]) –

  • │ │ │
  • exc (Type[jinja2.exceptions.TemplateRuntimeError]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class jinja2.StrictUndefined
│ │ │ @@ -1225,22 +1225,22 @@ │ │ │ ... │ │ │ jinja2.exceptions.UndefinedError: 'foo' is undefined │ │ │ │ │ │ │ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • hint (Optional[str]) –

  • │ │ │ +
  • hint (Optional[str]) –

  • │ │ │
  • obj (Any) –

  • │ │ │ -
  • name (Optional[str]) –

  • │ │ │ +
  • name (Optional[str]) –

  • │ │ │
  • exc (Type[jinja2.exceptions.TemplateRuntimeError]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │

There is also a factory function that can decorate undefined objects to │ │ │ implement logging on failures:

│ │ │
│ │ │ @@ -1259,15 +1259,15 @@ │ │ │ │ │ │
│ │ │

New in version 2.8.

│ │ │
│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • logger (Optional[logging.Logger]) – the logger to use. If not provided, a default logger │ │ │ +

  • logger (Optional[logging.Logger]) – the logger to use. If not provided, a default logger │ │ │ is created.

  • │ │ │
  • base (Type[jinja2.runtime.Undefined]) – the base class to add logging functionality to. This │ │ │ defaults to Undefined.

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

Type[jinja2.runtime.Undefined]

│ │ │ @@ -1325,18 +1325,18 @@ │ │ │ __getitem__, __contains__). Additionally there is a resolve() │ │ │ method that doesn’t fail with a KeyError but returns an │ │ │ Undefined object for missing variables.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • environment (Environment) –

  • │ │ │ -
  • parent (Dict[str, Any]) –

  • │ │ │ -
  • name (Optional[str]) –

  • │ │ │ -
  • blocks (Dict[str, Callable[[Context], Iterator[str]]]) –

  • │ │ │ -
  • globals (Optional[MutableMapping[str, Any]]) –

  • │ │ │ +
  • parent (Dict[str, Any]) –

  • │ │ │ +
  • name (Optional[str]) –

  • │ │ │ +
  • blocks (Dict[str, Callable[[Context], Iterator[str]]]) –

  • │ │ │ +
  • globals (Optional[MutableMapping[str, Any]]) –

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ parent
│ │ │

A dict of read only, global variables the template looks up. These │ │ │ @@ -1416,15 +1416,15 @@ │ │ │

│ │ │ get(key, default=None)
│ │ │

Look up a variable by name, or return a default if the key is │ │ │ not found.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • key (str) – The variable name to look up.

  • │ │ │ +
  • key (str) – The variable name to look up.

  • │ │ │
  • default (Optional[Any]) – The value to return if the key is not found.

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

Any

│ │ │
│ │ │
│ │ │ @@ -1434,41 +1434,41 @@ │ │ │
│ │ │ get_all()
│ │ │

Return the complete context as dict including the exported │ │ │ variables. For optimizations reasons this might not return an │ │ │ actual copy so be careful with using it.

│ │ │
│ │ │
Return type
│ │ │ -

Dict[str, Any]

│ │ │ +

Dict[str, Any]

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ get_exported()
│ │ │

Get a new dict with the exported variables.

│ │ │
│ │ │
Return type
│ │ │ -

Dict[str, Any]

│ │ │ +

Dict[str, Any]

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ resolve(key)
│ │ │

Look up a variable by name, or return an Undefined │ │ │ object if the key is not found.

│ │ │

If you need to add custom behavior, override │ │ │ resolve_or_missing(), not this method. The various lookup │ │ │ functions use that method, not this one.

│ │ │
│ │ │
Parameters
│ │ │ -

key (str) – The variable name to look up.

│ │ │ +

key (str) – The variable name to look up.

│ │ │
│ │ │
Return type
│ │ │

Union[Any, jinja2.runtime.Undefined]

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -1478,15 +1478,15 @@ │ │ │

Look up a variable by name, or return a missing sentinel │ │ │ if the key is not found.

│ │ │

Override this method to add custom lookup behavior. │ │ │ resolve(), get(), and __getitem__() use this │ │ │ method. Don’t call this method directly.

│ │ │
│ │ │
Parameters
│ │ │ -

key (str) – The variable name to look up.

│ │ │ +

key (str) – The variable name to look up.

│ │ │
│ │ │
Return type
│ │ │

Any

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -1555,19 +1555,19 @@ │ │ │ changed. No arguments are passed so the function must store the │ │ │ old state somewhere (for example in a closure). If it returns False │ │ │ the template will be reloaded.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • environment (Environment) –

  • │ │ │ -
  • template (str) –

  • │ │ │ +
  • template (str) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

Tuple[str, Optional[str], Optional[Callable[[], bool]]]

│ │ │ +

Tuple[str, Optional[str], Optional[Callable[[], bool]]]

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ load(environment, name, globals=None)
│ │ │ @@ -1576,16 +1576,16 @@ │ │ │ override this method as loaders working on collections of other │ │ │ loaders (such as PrefixLoader or ChoiceLoader) │ │ │ will not call this method but get_source directly.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • environment (Environment) –

  • │ │ │ -
  • name (str) –

  • │ │ │ -
  • globals (Optional[MutableMapping[str, Any]]) –

  • │ │ │ +
  • name (str) –

  • │ │ │ +
  • globals (Optional[MutableMapping[str, Any]]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

Template

│ │ │
│ │ │
│ │ │
│ │ │ @@ -1606,46 +1606,46 @@ │ │ │ order, stopping at the first matching template.

│ │ │
loader = FileSystemLoader(["/override/templates", "/default/templates"])
│ │ │  
│ │ │
│ │ │
│ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │

Changed in version 2.8: Added the followlinks parameter.

│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.PackageLoader(package_name, package_path='templates', encoding='utf-8')
│ │ │

Load templates from a directory in a Python package.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • package_name (str) – Import name of the package that contains the │ │ │ +

  • package_name (str) – Import name of the package that contains the │ │ │ template directory.

  • │ │ │ -
  • package_path (str) – Directory within the imported package that │ │ │ +

  • package_path (str) – Directory within the imported package that │ │ │ contains the templates.

  • │ │ │ -
  • encoding (str) – Encoding of template files.

  • │ │ │ +
  • encoding (str) – Encoding of template files.

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │

The following example looks up templates in the pages directory │ │ │ within the project.ui package.

│ │ │
loader = PackageLoader("project.ui", "pages")
│ │ │  
│ │ │
│ │ │ @@ -1672,18 +1672,18 @@ │ │ │ template source. This loader is useful for unittesting:

│ │ │
>>> loader = DictLoader({'index.html': 'source here'})
│ │ │  
│ │ │
│ │ │

Because auto reloading is rarely useful this is disabled per default.

│ │ │
│ │ │
Parameters
│ │ │ -

mapping (Mapping[str, str]) –

│ │ │ +

mapping (Mapping[str, str]) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class jinja2.FunctionLoader(load_func)
│ │ │ @@ -1700,18 +1700,18 @@ │ │ │ │ │ │

The uptodatefunc is a function that is called if autoreload is enabled │ │ │ and has to return True if the template is still up to date. For more │ │ │ details have a look at BaseLoader.get_source() which has the same │ │ │ return value.

│ │ │
│ │ │
Parameters
│ │ │ -

load_func (Callable[[str], Optional[Union[str, Tuple[str, Optional[str], Optional[Callable[[], bool]]]]]]) –

│ │ │ +

load_func (Callable[[str], Optional[Union[str, Tuple[str, Optional[str], Optional[Callable[[], bool]]]]]]) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class jinja2.PrefixLoader(mapping, delimiter='/')
│ │ │ @@ -1726,20 +1726,20 @@ │ │ │ │ │ │ │ │ │

By loading 'app1/index.html' the file from the app1 package is loaded, │ │ │ by loading 'app2/index.html' the file from the second.

│ │ │
│ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class jinja2.ChoiceLoader(loaders)
│ │ │ @@ -1755,15 +1755,15 @@ │ │ │

This is useful if you want to allow users to override builtin templates │ │ │ from a different location.

│ │ │
│ │ │
Parameters
│ │ │

loaders (Sequence[jinja2.loaders.BaseLoader]) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class jinja2.ModuleLoader(path)
│ │ │ @@ -1774,18 +1774,18 @@ │ │ │ ... FileSystemLoader('/path/to/templates') │ │ │ ... ]) │ │ │ │ │ │ │ │ │

Templates can be precompiled with Environment.compile_templates().

│ │ │
│ │ │
Parameters
│ │ │ -

path (Union[str, os.PathLike, Sequence[Union[str, os.PathLike]]]) –

│ │ │ +

path (Union[str, os.PathLike, Sequence[Union[str, os.PathLike]]]) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │

Bytecode Cache

│ │ │ @@ -1828,15 +1828,15 @@ │ │ │
│ │ │ clear()
│ │ │

Clears the cache. This method is not used by Jinja but should be │ │ │ implemented to allow applications to clear the bytecode cache used │ │ │ by a particular environment.

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ dump_bytecode(bucket)
│ │ │ @@ -1844,15 +1844,15 @@ │ │ │ from a bucket back to the cache. If it unable to do so it must not │ │ │ fail silently but raise an exception.

│ │ │
│ │ │
Parameters
│ │ │

bucket (jinja2.bccache.Bucket) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ load_bytecode(bucket)
│ │ │ @@ -1860,15 +1860,15 @@ │ │ │ bucket. If they are not able to find code in the cache for the │ │ │ bucket, it must not do anything.

│ │ │
│ │ │
Parameters
│ │ │

bucket (jinja2.bccache.Bucket) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ @@ -1879,20 +1879,20 @@ │ │ │

The buckets get an internal checksum from the cache assigned and use this │ │ │ to automatically reject outdated cache material. Individual bytecode │ │ │ cache subclasses don’t have to care about cache invalidation.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • environment (Environment) –

  • │ │ │ -
  • key (str) –

  • │ │ │ -
  • checksum (str) –

  • │ │ │ +
  • key (str) –

  • │ │ │ +
  • checksum (str) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ environment
│ │ │

The Environment that created the bucket.

│ │ │
│ │ │ @@ -1911,68 +1911,68 @@ │ │ │ │ │ │
│ │ │
│ │ │ bytecode_from_string(string)
│ │ │

Load bytecode from bytes.

│ │ │
│ │ │
Parameters
│ │ │ -

string (bytes) –

│ │ │ +

string (bytes) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ bytecode_to_string()
│ │ │

Return the bytecode as bytes.

│ │ │
│ │ │
Return type
│ │ │ -

bytes

│ │ │ +

bytes

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ load_bytecode(f)
│ │ │

Loads bytecode from a file or file like object.

│ │ │
│ │ │
Parameters
│ │ │

f (BinaryIO) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ reset()
│ │ │

Resets the bucket (unloads the bytecode).

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ write_bytecode(f)
│ │ │

Dump the bytecode into the file or file like object passed.

│ │ │
│ │ │
Parameters
│ │ │

f (BinaryIO) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ │ │ │

Builtin bytecode caches:

│ │ │ @@ -1991,20 +1991,20 @@ │ │ │
>>> bcc = FileSystemBytecodeCache('/tmp/jinja_cache', '%s.cache')
│ │ │  
│ │ │
│ │ │

This bytecode cache supports clearing of the cache using the clear method.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • directory (Optional[str]) –

  • │ │ │ -
  • pattern (str) –

  • │ │ │ +
  • directory (Optional[str]) –

  • │ │ │ +
  • pattern (str) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.MemcachedBytecodeCache(client, prefix='jinja2/bytecode/', timeout=None, ignore_memcache_errors=True)
│ │ │ @@ -2022,17 +2022,17 @@ │ │ │ the underlying cache client to the bytecode cache which is available │ │ │ as django.core.cache.cache._client.)

│ │ │

The minimal interface for the client passed to the constructor is this:

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • client (_MemcachedClient) –

  • │ │ │ -
  • prefix (str) –

  • │ │ │ -
  • timeout (Optional[int]) –

  • │ │ │ -
  • ignore_memcache_errors (bool) –

  • │ │ │ +
  • prefix (str) –

  • │ │ │ +
  • timeout (Optional[int]) –

  • │ │ │ +
  • ignore_memcache_errors (bool) –

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ class MinimalClientInterface
│ │ │
│ │ │ @@ -2078,15 +2078,15 @@ │ │ │ use.

│ │ │

By default, async support is disabled. Enabling it will cause the │ │ │ environment to compile different code behind the scenes in order to │ │ │ handle async and sync code in an asyncio event loop. This has the │ │ │ following implications:

│ │ │
    │ │ │
  • Template rendering requires an event loop to be available to the │ │ │ -current thread. asyncio.get_running_loop() must return an │ │ │ +current thread. asyncio.get_running_loop() must return an │ │ │ event loop.

  • │ │ │
  • The compiled code uses await for functions and attributes, and │ │ │ uses async for loops. In order to support using both async and │ │ │ sync functions in this context, a small wrapper is placed around │ │ │ all calls and access, which adds overhead compared to purely async │ │ │ code.

  • │ │ │
  • Sync methods and filters become wrappers around their corresponding │ │ │ @@ -2334,15 +2334,15 @@ │ │ │ jinja2.clear_caches() │ │ │

    Jinja keeps internal caches for environments and lexers. These are │ │ │ used so that Jinja doesn’t have to recreate environments and lexers all │ │ │ the time. Normally you don’t have to care about that but if you are │ │ │ measuring memory consumption you may want to clean the caches.

    │ │ │
    │ │ │
    Return type
    │ │ │ -

    None

    │ │ │ +

    None

    │ │ │
    │ │ │
    │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ jinja2.is_undefined(obj)
│ │ │ @@ -2358,46 +2358,46 @@ │ │ │
│ │ │ │ │ │
│ │ │
Parameters
│ │ │

obj (Any) –

│ │ │
│ │ │
Return type
│ │ │ -

bool

│ │ │ +

bool

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │

Exceptions

│ │ │
│ │ │
│ │ │ exception jinja2.TemplateError(message=None)
│ │ │

Baseclass for all template errors.

│ │ │
│ │ │
Parameters
│ │ │ -

message (Optional[str]) –

│ │ │ +

message (Optional[str]) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ exception jinja2.UndefinedError(message=None)
│ │ │

Raised if a template tries to operate on Undefined.

│ │ │
│ │ │
Parameters
│ │ │ -

message (Optional[str]) –

│ │ │ +

message (Optional[str]) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ exception jinja2.TemplateNotFound(name, message=None)
│ │ │ @@ -2405,20 +2405,20 @@ │ │ │
│ │ │

Changed in version 2.11: If the given name is Undefined and no message was │ │ │ provided, an UndefinedError is raised.

│ │ │
│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • name (Optional[Union[str, Undefined]]) –

  • │ │ │ -
  • message (Optional[str]) –

  • │ │ │ +
  • name (Optional[Union[str, Undefined]]) –

  • │ │ │ +
  • message (Optional[str]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ exception jinja2.TemplatesNotFound(names=(), message=None)
│ │ │ @@ -2431,39 +2431,39 @@ │ │ │
│ │ │
│ │ │

New in version 2.2.

│ │ │
│ │ │
│ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ exception jinja2.TemplateSyntaxError(message, lineno, name=None, filename=None)
│ │ │

Raised to tell the user that there is a problem with the template.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • message (str) –

  • │ │ │ -
  • lineno (int) –

  • │ │ │ -
  • name (Optional[str]) –

  • │ │ │ -
  • filename (Optional[str]) –

  • │ │ │ +
  • message (str) –

  • │ │ │ +
  • lineno (int) –

  • │ │ │ +
  • name (Optional[str]) –

  • │ │ │ +
  • filename (Optional[str]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ message
│ │ │

The error message.

│ │ │
│ │ │ @@ -2492,40 +2492,40 @@ │ │ │
│ │ │
│ │ │ exception jinja2.TemplateRuntimeError(message=None)
│ │ │

A generic runtime error in the template engine. Under some situations │ │ │ Jinja may raise this exception.

│ │ │
│ │ │
Parameters
│ │ │ -

message (Optional[str]) –

│ │ │ +

message (Optional[str]) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ exception jinja2.TemplateAssertionError(message, lineno, name=None, filename=None)
│ │ │

Like a template syntax error, but covers cases where something in the │ │ │ template caused an error at compile time that wasn’t necessarily caused │ │ │ by a syntax error. However it’s a direct subclass of │ │ │ TemplateSyntaxError and has the same attributes.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • message (str) –

  • │ │ │ -
  • lineno (int) –

  • │ │ │ -
  • name (Optional[str]) –

  • │ │ │ -
  • filename (Optional[str]) –

  • │ │ │ +
  • message (str) –

  • │ │ │ +
  • lineno (int) –

  • │ │ │ +
  • name (Optional[str]) –

  • │ │ │ +
  • filename (Optional[str]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │

Custom Filters

│ │ │ @@ -2676,19 +2676,19 @@ │ │ │ class jinja2.nodes.EvalContext(environment, template_name=None) │ │ │

Holds evaluation time information. Custom attributes can be attached │ │ │ to it in extensions.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • environment (Environment) –

  • │ │ │ -
  • template_name (Optional[str]) –

  • │ │ │ +
  • template_name (Optional[str]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ autoescape
│ │ │

True or False depending on if autoescaping is active or not.

│ │ │
│ │ │ @@ -2738,21 +2738,21 @@ │ │ │ and debugging templates.

│ │ │

This does not perform preprocessing. If you want the preprocessing │ │ │ of the extensions to be applied you have to filter source through │ │ │ the preprocess() method.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • source (str) –

  • │ │ │ -
  • name (Optional[str]) –

  • │ │ │ -
  • filename (Optional[str]) –

  • │ │ │ +
  • source (str) –

  • │ │ │ +
  • name (Optional[str]) –

  • │ │ │ +
  • filename (Optional[str]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

Iterator[Tuple[int, str, str]]

│ │ │ +

Iterator[Tuple[int, str, str]]

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ Environment.parse(source, name=None, filename=None)
│ │ │ @@ -2761,17 +2761,17 @@ │ │ │ executable source- or bytecode. This is useful for debugging or to │ │ │ extract information from templates.

│ │ │

If you are developing Jinja extensions │ │ │ this gives you a good overview of the node tree generated.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • source (str) –

  • │ │ │ -
  • name (Optional[str]) –

  • │ │ │ -
  • filename (Optional[str]) –

  • │ │ │ +
  • source (str) –

  • │ │ │ +
  • name (Optional[str]) –

  • │ │ │ +
  • filename (Optional[str]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

jinja2.nodes.Template

│ │ │
│ │ │
│ │ │
│ │ │ @@ -2781,21 +2781,21 @@ │ │ │ Environment.preprocess(source, name=None, filename=None) │ │ │

Preprocesses the source with all extensions. This is automatically │ │ │ called for all parsing and compiling methods but not for lex() │ │ │ because there you usually only want the actual source tokenized.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • source (str) –

  • │ │ │ -
  • name (Optional[str]) –

  • │ │ │ -
  • filename (Optional[str]) –

  • │ │ │ +
  • source (str) –

  • │ │ │ +
  • name (Optional[str]) –

  • │ │ │ +
  • filename (Optional[str]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

str

│ │ │ +

str

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ Template.new_context(vars=None, shared=False, locals=None)
│ │ │ @@ -2803,17 +2803,17 @@ │ │ │ provided will be passed to the template. Per default the globals │ │ │ are added to the context. If shared is set to True the data │ │ │ is passed as is to the context without adding the globals.

│ │ │

locals can be a dict of local variables for internal usage.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • vars (Optional[Dict[str, Any]]) –

  • │ │ │ -
  • shared (bool) –

  • │ │ │ -
  • locals (Optional[Mapping[str, Any]]) –

  • │ │ │ +
  • vars (Optional[Dict[str, Any]]) –

  • │ │ │ +
  • shared (bool) –

  • │ │ │ +
  • locals (Optional[Mapping[str, Any]]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

jinja2.runtime.Context

│ │ │
│ │ │
│ │ │
│ │ │ @@ -2885,15 +2885,15 @@ │ │ │ fact this function can currently raise that exception as well.

│ │ │ │ │ │
│ │ │
Parameters
│ │ │

ast (jinja2.nodes.Template) –

│ │ │
│ │ │
Return type
│ │ │ -

Set[str]

│ │ │ +

Set[str]

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ jinja2.meta.find_referenced_templates(ast)
│ │ │ @@ -2911,15 +2911,15 @@ │ │ │

This function is useful for dependency tracking. For example if you want │ │ │ to rebuild parts of the website after a layout template has changed.

│ │ │
│ │ │
Parameters
│ │ │

ast (jinja2.nodes.Template) –

│ │ │
│ │ │
Return type
│ │ │ -

Iterator[Optional[str]]

│ │ │ +

Iterator[Optional[str]]

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/python-jinja2-doc/html/changes.html │ │ │ @@ -149,15 +149,15 @@ │ │ │ │ │ │ │ │ │
│ │ │

Version 2.11.2

│ │ │

Released 2020-04-13

│ │ │ │ │ ├── ./usr/share/doc/python-jinja2-doc/html/extensions.html │ │ │ @@ -81,15 +81,15 @@ │ │ │ additional methods:

│ │ │
│ │ │
│ │ │ jinja2.Environment.install_gettext_translations(translations, newstyle=False)
│ │ │

Installs a translation globally for the environment. The │ │ │ translations object must implement gettext, ngettext, │ │ │ and optionally pgettext and npgettext. │ │ │ -gettext.NullTranslations, gettext.GNUTranslations, │ │ │ +gettext.NullTranslations, gettext.GNUTranslations, │ │ │ and Babels Translations are supported.

│ │ │
│ │ │

Changed in version 3.0: Added pgettext and npgettext.

│ │ │
│ │ │
│ │ │

Changed in version 2.5: Added new-style gettext support.

│ │ │
│ │ │ @@ -107,16 +107,16 @@ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ jinja2.Environment.install_gettext_callables(gettext, ngettext, newstyle=False, pgettext=None, npgettext=None)
│ │ │

Install the given gettext, ngettext, pgettext, and │ │ │ npgettext callables into the environment. They should behave │ │ │ -exactly like gettext.gettext(), gettext.ngettext(), │ │ │ -gettext.pgettext() and gettext.npgettext().

│ │ │ +exactly like gettext.gettext(), gettext.ngettext(), │ │ │ +gettext.pgettext() and gettext.npgettext().

│ │ │

If newstyle is activated, the callables are wrapped to work like │ │ │ newstyle callables. See New Style Gettext for more information.

│ │ │
│ │ │

Changed in version 3.0: Added pgettext and npgettext.

│ │ │
│ │ │
│ │ │

New in version 2.5: Added new-style gettext support.

│ │ │ @@ -463,15 +463,15 @@ │ │ │ is a terrible name, fragment_cache_prefix on the other hand is a good │ │ │ name as includes the name of the extension (fragment cache).

│ │ │
│ │ │
Parameters
│ │ │

environment (jinja2.environment.Environment) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ identifier
│ │ │

The identifier of the extension. This is always the true import name │ │ │ of the extension class and must not be changed.

│ │ │ @@ -491,16 +491,16 @@ │ │ │ to pass constants on extensions to generated template code.

│ │ │
self.attr('_my_attribute', lineno=lineno)
│ │ │  
│ │ │
│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • name (str) –

  • │ │ │ -
  • lineno (Optional[int]) –

  • │ │ │ +
  • name (str) –

  • │ │ │ +
  • lineno (Optional[int]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

jinja2.nodes.ExtensionAttribute

│ │ │
│ │ │
│ │ │
│ │ │ @@ -509,20 +509,20 @@ │ │ │
│ │ │ call_method(name, args=None, kwargs=None, dyn_args=None, dyn_kwargs=None, lineno=None)
│ │ │

Call a method of the extension. This is a shortcut for │ │ │ attr() + jinja2.nodes.Call.

│ │ │
│ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │

jinja2.nodes.Call

│ │ │
│ │ │
│ │ │
│ │ │ @@ -566,21 +566,21 @@ │ │ │ preprocess(source, name, filename=None) │ │ │

This method is called before the actual lexing and can be used to │ │ │ preprocess the source. The filename is optional. The return value │ │ │ must be the preprocessed source.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • source (str) –

  • │ │ │ -
  • name (Optional[str]) –

  • │ │ │ -
  • filename (Optional[str]) –

  • │ │ │ +
  • source (str) –

  • │ │ │ +
  • name (Optional[str]) –

  • │ │ │ +
  • filename (Optional[str]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

str

│ │ │ +

str

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ @@ -594,22 +594,22 @@ │ │ │ class jinja2.parser.Parser(environment, source, name=None, filename=None, state=None) │ │ │

This is the central parsing class Jinja uses. It’s passed to │ │ │ extensions and can be used to parse expressions or statements.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • environment (Environment) –

  • │ │ │ -
  • source (str) –

  • │ │ │ -
  • name (Optional[str]) –

  • │ │ │ -
  • filename (Optional[str]) –

  • │ │ │ -
  • state (Optional[str]) –

  • │ │ │ +
  • source (str) –

  • │ │ │ +
  • name (Optional[str]) –

  • │ │ │ +
  • filename (Optional[str]) –

  • │ │ │ +
  • state (Optional[str]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ filename
│ │ │

The filename of the template the parser processes. This is not │ │ │ the load name of the template. For the load name see name. │ │ │ @@ -634,16 +634,16 @@ │ │ │ fail(msg, lineno=None, exc=<class 'jinja2.exceptions.TemplateSyntaxError'>) │ │ │

Convenience method that raises exc with the message, passed │ │ │ line number or last line number as well as the current name and │ │ │ filename.

│ │ │
│ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │

te.NoReturn

│ │ │
│ │ │
│ │ │ @@ -651,15 +651,15 @@ │ │ │ │ │ │
│ │ │
│ │ │ free_identifier(lineno=None)
│ │ │

Return a new free identifier as InternalName.

│ │ │
│ │ │
Parameters
│ │ │ -

lineno (Optional[int]) –

│ │ │ +

lineno (Optional[int]) –

│ │ │
│ │ │
Return type
│ │ │

jinja2.nodes.InternalName

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -672,18 +672,18 @@ │ │ │ by setting with_tuple to False. If only assignments to names are │ │ │ wanted name_only can be set to True. The extra_end_rules │ │ │ parameter is forwarded to the tuple parsing function. If │ │ │ with_namespace is enabled, a namespace assignment may be parsed.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • with_tuple (bool) –

  • │ │ │ -
  • name_only (bool) –

  • │ │ │ -
  • extra_end_rules (Optional[Tuple[str, ...]]) –

  • │ │ │ -
  • with_namespace (bool) –

  • │ │ │ +
  • with_tuple (bool) –

  • │ │ │ +
  • name_only (bool) –

  • │ │ │ +
  • extra_end_rules (Optional[Tuple[str, ...]]) –

  • │ │ │ +
  • with_namespace (bool) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

Union[jinja2.nodes.NSRef, jinja2.nodes.Name, jinja2.nodes.Tuple]

│ │ │
│ │ │
│ │ │
│ │ │ @@ -692,15 +692,15 @@ │ │ │
│ │ │ parse_expression(with_condexpr=True)
│ │ │

Parse an expression. Per default all expressions are parsed, if │ │ │ the optional with_condexpr parameter is set to False conditional │ │ │ expressions are not parsed.

│ │ │
│ │ │
Parameters
│ │ │ -

with_condexpr (bool) –

│ │ │ +

with_condexpr (bool) –

│ │ │
│ │ │
Return type
│ │ │

jinja2.nodes.Expr

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -714,16 +714,16 @@ │ │ │ for the block end and parses until if one of the end_tokens is │ │ │ reached. Per default the active token in the stream at the end of │ │ │ the call is the matched end token. If this is not wanted drop_needle │ │ │ can be set to True and the end token is removed.

│ │ │
│ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │

List[jinja2.nodes.Node]

│ │ │
│ │ │
│ │ │ │ │ │ @@ -744,18 +744,18 @@ │ │ │ extra_end_rules is set to ['name:in'].

│ │ │

explicit_parentheses is true if the parsing was triggered by an │ │ │ expression in parentheses. This is used to figure out if an empty │ │ │ tuple is a valid expression or not.

│ │ │
│ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │

Union[jinja2.nodes.Tuple, jinja2.nodes.Expr]

│ │ │
│ │ │
│ │ │ │ │ │ @@ -768,51 +768,51 @@ │ │ │

A token stream is an iterable that yields Tokens. The │ │ │ parser however does not iterate over it but calls next() to go │ │ │ one token ahead. The current active token is stored as current.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • generator (Iterable[jinja2.lexer.Token]) –

  • │ │ │ -
  • name (Optional[str]) –

  • │ │ │ -
  • filename (Optional[str]) –

  • │ │ │ +
  • name (Optional[str]) –

  • │ │ │ +
  • filename (Optional[str]) –

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ current
│ │ │

The current Token.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ __next__()
│ │ │

Go one token ahead and return the old one.

│ │ │ -

Use the built-in next() instead of calling this directly.

│ │ │ +

Use the built-in next() instead of calling this directly.

│ │ │
│ │ │
Return type
│ │ │

jinja2.lexer.Token

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -property eos: bool
│ │ │ +property eos: bool │ │ │

Are we at the end of the stream?

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ expect(expr)
│ │ │

Expect a given token type and return it. This accepts the same │ │ │ argument as jinja2.lexer.Token.test().

│ │ │
│ │ │
Parameters
│ │ │ -

expr (str) –

│ │ │ +

expr (str) –

│ │ │
│ │ │
Return type
│ │ │

jinja2.lexer.Token

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -830,15 +830,15 @@ │ │ │
│ │ │
│ │ │ next_if(expr)
│ │ │

Perform the token test and return the token if it matched. │ │ │ Otherwise the return value is None.

│ │ │
│ │ │
Parameters
│ │ │ -

expr (str) –

│ │ │ +

expr (str) –

│ │ │
│ │ │
Return type
│ │ │

Optional[jinja2.lexer.Token]

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -847,58 +847,58 @@ │ │ │ push(token) │ │ │

Push a token back to the stream.

│ │ │
│ │ │
Parameters
│ │ │

token (jinja2.lexer.Token) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ skip(n=1)
│ │ │

Got n tokens ahead.

│ │ │
│ │ │
Parameters
│ │ │ -

n (int) –

│ │ │ +

n (int) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ skip_if(expr)
│ │ │

Like next_if() but only returns True or False.

│ │ │
│ │ │
Parameters
│ │ │ -

expr (str) –

│ │ │ +

expr (str) –

│ │ │
│ │ │
Return type
│ │ │ -

bool

│ │ │ +

bool

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.lexer.Token(lineno, type, value)
│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • lineno (int) –

  • │ │ │ -
  • type (str) –

  • │ │ │ -
  • value (str) –

  • │ │ │ +
  • lineno (int) –

  • │ │ │ +
  • type (str) –

  • │ │ │ +
  • value (str) –

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ lineno
│ │ │

The line number of the token

│ │ │ @@ -921,32 +921,32 @@ │ │ │
│ │ │ test(expr)
│ │ │

Test a token against a token expression. This can either be a │ │ │ token type or 'token_type:token_value'. This can only test │ │ │ against string values and types.

│ │ │
│ │ │
Parameters
│ │ │ -

expr (str) –

│ │ │ +

expr (str) –

│ │ │
│ │ │
Return type
│ │ │ -

bool

│ │ │ +

bool

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ test_any(*iterable)
│ │ │

Test against multiple token expressions.

│ │ │
│ │ │
Parameters
│ │ │ -

iterable (str) –

│ │ │ +

iterable (str) –

│ │ │
│ │ │
Return type
│ │ │ -

bool

│ │ │ +

bool

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ │ │ │

There is also a utility function in the lexer module that can count newline │ │ │ @@ -954,18 +954,18 @@ │ │ │

│ │ │
│ │ │ jinja2.lexer.count_newlines(value)
│ │ │

Count the number of newline characters in the string. This is │ │ │ useful for extensions that filter a stream.

│ │ │
│ │ │
Parameters
│ │ │ -

value (str) –

│ │ │ +

value (str) –

│ │ │
│ │ │
Return type
│ │ │ -

int

│ │ │ +

int

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │

AST

│ │ │ @@ -997,15 +997,15 @@ │ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ find(node_type)
│ │ │

Find the first node of a given type. If no such node exists the │ │ │ return value is None.

│ │ │ @@ -1039,16 +1039,16 @@ │ │ │ iter_child_nodes(exclude=None, only=None) │ │ │

Iterates over all direct child nodes of the node. This iterates │ │ │ over all fields and yields the values of they are nodes. If the value │ │ │ of a field is a list all the nodes in that list are returned.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • exclude (Optional[Container[str]]) –

  • │ │ │ -
  • only (Optional[Container[str]]) –

  • │ │ │ +
  • exclude (Optional[Container[str]]) –

  • │ │ │ +
  • only (Optional[Container[str]]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

Iterator[jinja2.nodes.Node]

│ │ │
│ │ │
│ │ │
│ │ │ @@ -1060,34 +1060,34 @@ │ │ │ (key, value) tuples. Per default all fields are returned, but │ │ │ it’s possible to limit that to some fields by providing the only │ │ │ parameter or to exclude some using the exclude parameter. Both │ │ │ should be sets or tuples of field names.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • exclude (Optional[Container[str]]) –

  • │ │ │ -
  • only (Optional[Container[str]]) –

  • │ │ │ +
  • exclude (Optional[Container[str]]) –

  • │ │ │ +
  • only (Optional[Container[str]]) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

Iterator[Tuple[str, Any]]

│ │ │ +

Iterator[Tuple[str, Any]]

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ set_ctx(ctx)
│ │ │

Reset the context of a node and all child nodes. Per default the │ │ │ parser will all generate nodes that have a ‘load’ context as it’s the │ │ │ most common one. This method is used in the parser to set assignment │ │ │ targets and other nodes to a store context.

│ │ │
│ │ │
Parameters
│ │ │ -

ctx (str) –

│ │ │ +

ctx (str) –

│ │ │
│ │ │
Return type
│ │ │

jinja2.nodes.Node

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -1108,16 +1108,16 @@ │ │ │
│ │ │
│ │ │ set_lineno(lineno, override=False)
│ │ │

Set the line numbers of the node and children.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • lineno (int) –

  • │ │ │ -
  • override (bool) –

  • │ │ │ +
  • lineno (int) –

  • │ │ │ +
  • override (bool) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

jinja2.nodes.Node

│ │ │
│ │ │
│ │ │
│ │ │ @@ -1135,15 +1135,15 @@ │ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ as_const(eval_ctx=None)
│ │ │

Return the value of the expression as constant or raise │ │ │ Impossible if this was not possible.

│ │ │ @@ -1165,15 +1165,15 @@ │ │ │ │ │ │
│ │ │
│ │ │ can_assign()
│ │ │

Check if it’s possible to assign something to this node.

│ │ │
│ │ │
Return type
│ │ │ -

bool

│ │ │ +

bool

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ @@ -1186,15 +1186,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Filter(node, name, args, kwargs, dyn_args, dyn_kwargs)
│ │ │ @@ -1209,15 +1209,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Test(node, name, args, kwargs, dyn_args, dyn_kwargs)
│ │ │ @@ -1235,15 +1235,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.BinExpr(left, right)
│ │ │ @@ -1255,15 +1255,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Add(left, right)
│ │ │ @@ -1275,15 +1275,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.And(left, right)
│ │ │ @@ -1295,15 +1295,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Div(left, right)
│ │ │ @@ -1315,15 +1315,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.FloorDiv(left, right)
│ │ │ @@ -1336,15 +1336,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Mod(left, right)
│ │ │ @@ -1356,15 +1356,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Mul(left, right)
│ │ │ @@ -1376,15 +1376,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Or(left, right)
│ │ │ @@ -1396,15 +1396,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Pow(left, right)
│ │ │ @@ -1416,15 +1416,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Sub(left, right)
│ │ │ @@ -1436,15 +1436,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Call(node, args, kwargs, dyn_args, dyn_kwargs)
│ │ │ @@ -1460,15 +1460,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Compare(expr, ops)
│ │ │ @@ -1481,15 +1481,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Concat(nodes)
│ │ │ @@ -1502,15 +1502,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.CondExpr(test, expr1, expr2)
│ │ │ @@ -1523,15 +1523,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.ContextReference
│ │ │ @@ -1555,15 +1555,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.DerivedContextReference
│ │ │ @@ -1580,15 +1580,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.EnvironmentAttribute(name)
│ │ │ @@ -1601,15 +1601,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.ExtensionAttribute(identifier, name)
│ │ │ @@ -1624,15 +1624,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Getattr(node, attr, ctx)
│ │ │ @@ -1645,15 +1645,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Getitem(node, arg, ctx)
│ │ │ @@ -1665,15 +1665,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.ImportedName(importname)
│ │ │ @@ -1688,15 +1688,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.InternalName(name)
│ │ │ @@ -1706,15 +1706,15 @@ │ │ │ a new identifier for you. This identifier is not available from the │ │ │ template and is not treated specially by the compiler.

│ │ │
│ │ │
Node type
│ │ │

Expr

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Literal
│ │ │ @@ -1726,15 +1726,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Const(value)
│ │ │ @@ -1749,15 +1749,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Dict(items)
│ │ │ @@ -1770,15 +1770,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.List(items)
│ │ │ @@ -1790,15 +1790,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.TemplateData(data)
│ │ │ @@ -1810,15 +1810,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Tuple(items, ctx)
│ │ │ @@ -1832,15 +1832,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.MarkSafe(expr)
│ │ │ @@ -1852,15 +1852,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.MarkSafeIfAutoescape(expr)
│ │ │ @@ -1876,15 +1876,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Name(name, ctx)
│ │ │ @@ -1902,15 +1902,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.NSRef(name, attr)
│ │ │ @@ -1922,15 +1922,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Slice(start, stop, step)
│ │ │ @@ -1943,15 +1943,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.UnaryExpr(node)
│ │ │ @@ -1963,15 +1963,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Neg(node)
│ │ │ @@ -1983,15 +1983,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Not(node)
│ │ │ @@ -2003,15 +2003,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Pos(node)
│ │ │ @@ -2023,15 +2023,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Helper
│ │ │ @@ -2043,15 +2043,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Keyword(key, value)
│ │ │ @@ -2063,15 +2063,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Operand(op, expr)
│ │ │ @@ -2083,15 +2083,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Pair(key, value)
│ │ │ @@ -2103,15 +2103,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Stmt
│ │ │ @@ -2123,15 +2123,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Assign(target, node)
│ │ │ @@ -2143,15 +2143,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.AssignBlock(target, filter, body)
│ │ │ @@ -2163,15 +2163,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Block(name, body, scoped, required)
│ │ │ @@ -2186,15 +2186,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Break
│ │ │ @@ -2206,15 +2206,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.CallBlock(call, args, defaults, body)
│ │ │ @@ -2227,15 +2227,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Continue
│ │ │ @@ -2247,15 +2247,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.EvalContextModifier(options)
│ │ │ @@ -2272,15 +2272,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.ScopedEvalContextModifier(options, body)
│ │ │ @@ -2294,15 +2294,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.ExprStmt(node)
│ │ │ @@ -2314,15 +2314,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Extends(template)
│ │ │ @@ -2334,15 +2334,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.FilterBlock(body, filter)
│ │ │ @@ -2354,15 +2354,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.For(target, iter, body, else_, test, recursive)
│ │ │ @@ -2378,15 +2378,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.FromImport(template, names, with_context)
│ │ │ @@ -2405,15 +2405,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.If(test, body, elif_, else_)
│ │ │ @@ -2425,15 +2425,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Import(template, target, with_context)
│ │ │ @@ -2445,15 +2445,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Include(template, with_context, ignore_missing)
│ │ │ @@ -2465,15 +2465,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Macro(name, args, defaults, body)
│ │ │ @@ -2487,15 +2487,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Output(nodes)
│ │ │ @@ -2508,15 +2508,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.OverlayScope(context, body)
│ │ │ @@ -2539,15 +2539,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Scope(body)
│ │ │ @@ -2559,15 +2559,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.With(targets, values, body)
│ │ │ @@ -2583,15 +2583,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nodes.Template(body)
│ │ │ @@ -2604,15 +2604,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • fields (Any) –

  • │ │ │
  • attributes (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ exception jinja2.nodes.Impossible
│ │ ├── ./usr/share/doc/python-jinja2-doc/html/nativetypes.html │ │ │ @@ -102,79 +102,79 @@ │ │ │
│ │ │
│ │ │ class jinja2.nativetypes.NativeEnvironment([options])
│ │ │

An environment that renders templates to native Python types.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • block_start_string (str) –

  • │ │ │ -
  • block_end_string (str) –

  • │ │ │ -
  • variable_start_string (str) –

  • │ │ │ -
  • variable_end_string (str) –

  • │ │ │ -
  • comment_start_string (str) –

  • │ │ │ -
  • comment_end_string (str) –

  • │ │ │ -
  • line_statement_prefix (Optional[str]) –

  • │ │ │ -
  • line_comment_prefix (Optional[str]) –

  • │ │ │ -
  • trim_blocks (bool) –

  • │ │ │ -
  • lstrip_blocks (bool) –

  • │ │ │ +
  • block_start_string (str) –

  • │ │ │ +
  • block_end_string (str) –

  • │ │ │ +
  • variable_start_string (str) –

  • │ │ │ +
  • variable_end_string (str) –

  • │ │ │ +
  • comment_start_string (str) –

  • │ │ │ +
  • comment_end_string (str) –

  • │ │ │ +
  • line_statement_prefix (Optional[str]) –

  • │ │ │ +
  • line_comment_prefix (Optional[str]) –

  • │ │ │ +
  • trim_blocks (bool) –

  • │ │ │ +
  • lstrip_blocks (bool) –

  • │ │ │
  • newline_sequence (te.Literal['\n', '\r\n', '\r']) –

  • │ │ │ -
  • keep_trailing_newline (bool) –

  • │ │ │ -
  • extensions (Sequence[Union[str, Type[Extension]]]) –

  • │ │ │ -
  • optimized (bool) –

  • │ │ │ +
  • keep_trailing_newline (bool) –

  • │ │ │ +
  • extensions (Sequence[Union[str, Type[Extension]]]) –

  • │ │ │ +
  • optimized (bool) –

  • │ │ │
  • undefined (Type[jinja2.runtime.Undefined]) –

  • │ │ │
  • finalize (Optional[Callable[[...], Any]]) –

  • │ │ │ -
  • autoescape (Union[bool, Callable[[Optional[str]], bool]]) –

  • │ │ │ +
  • autoescape (Union[bool, Callable[[Optional[str]], bool]]) –

  • │ │ │
  • loader (Optional[BaseLoader]) –

  • │ │ │ -
  • cache_size (int) –

  • │ │ │ -
  • auto_reload (bool) –

  • │ │ │ +
  • cache_size (int) –

  • │ │ │ +
  • auto_reload (bool) –

  • │ │ │
  • bytecode_cache (Optional[BytecodeCache]) –

  • │ │ │ -
  • enable_async (bool) –

  • │ │ │ +
  • enable_async (bool) –

  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class jinja2.nativetypes.NativeTemplate([options])
│ │ │
│ │ │
Parameters
│ │ │
    │ │ │ -
  • source (Union[str, jinja2.nodes.Template]) –

  • │ │ │ -
  • block_start_string (str) –

  • │ │ │ -
  • block_end_string (str) –

  • │ │ │ -
  • variable_start_string (str) –

  • │ │ │ -
  • variable_end_string (str) –

  • │ │ │ -
  • comment_start_string (str) –

  • │ │ │ -
  • comment_end_string (str) –

  • │ │ │ -
  • line_statement_prefix (Optional[str]) –

  • │ │ │ -
  • line_comment_prefix (Optional[str]) –

  • │ │ │ -
  • trim_blocks (bool) –

  • │ │ │ -
  • lstrip_blocks (bool) –

  • │ │ │ +
  • source (Union[str, jinja2.nodes.Template]) –

  • │ │ │ +
  • block_start_string (str) –

  • │ │ │ +
  • block_end_string (str) –

  • │ │ │ +
  • variable_start_string (str) –

  • │ │ │ +
  • variable_end_string (str) –

  • │ │ │ +
  • comment_start_string (str) –

  • │ │ │ +
  • comment_end_string (str) –

  • │ │ │ +
  • line_statement_prefix (Optional[str]) –

  • │ │ │ +
  • line_comment_prefix (Optional[str]) –

  • │ │ │ +
  • trim_blocks (bool) –

  • │ │ │ +
  • lstrip_blocks (bool) –

  • │ │ │
  • newline_sequence (te.Literal['\n', '\r\n', '\r']) –

  • │ │ │ -
  • keep_trailing_newline (bool) –

  • │ │ │ -
  • extensions (Sequence[Union[str, Type[Extension]]]) –

  • │ │ │ -
  • optimized (bool) –

  • │ │ │ +
  • keep_trailing_newline (bool) –

  • │ │ │ +
  • extensions (Sequence[Union[str, Type[Extension]]]) –

  • │ │ │ +
  • optimized (bool) –

  • │ │ │
  • undefined (Type[jinja2.runtime.Undefined]) –

  • │ │ │
  • finalize (Optional[Callable[[...], Any]]) –

  • │ │ │ -
  • autoescape (Union[bool, Callable[[Optional[str]], bool]]) –

  • │ │ │ -
  • enable_async (bool) –

  • │ │ │ +
  • autoescape (Union[bool, Callable[[Optional[str]], bool]]) –

  • │ │ │ +
  • enable_async (bool) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

Any

│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ render(*args, **kwargs)
│ │ │

Render the template to produce a native Python type. If the │ │ │ result is a single node, its value is returned. Otherwise, the │ │ │ nodes are concatenated as strings. If the result can be parsed │ │ │ -with ast.literal_eval(), the parsed value is returned. │ │ │ +with ast.literal_eval(), the parsed value is returned. │ │ │ Otherwise, the string is returned.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • args (Any) –

  • │ │ │
  • kwargs (Any) –

  • │ │ │
│ │ ├── ./usr/share/doc/python-jinja2-doc/html/sandbox.html │ │ │ @@ -76,15 +76,15 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • args (Any) –

  • │ │ │
  • kwargs (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ call_binop(context, operator, left, right)
│ │ │

For intercepted binary operator calls (intercepted_binops()) │ │ │ this function is executed instead of the builtin operator. This can │ │ │ @@ -92,15 +92,15 @@ │ │ │

│ │ │

New in version 2.6.

│ │ │
│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • context (jinja2.runtime.Context) –

  • │ │ │ -
  • operator (str) –

  • │ │ │ +
  • operator (str) –

  • │ │ │
  • left (Any) –

  • │ │ │
  • right (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

Any

│ │ │
│ │ │ @@ -116,43 +116,43 @@ │ │ │
│ │ │

New in version 2.6.

│ │ │
│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • context (jinja2.runtime.Context) –

  • │ │ │ -
  • operator (str) –

  • │ │ │ +
  • operator (str) –

  • │ │ │
  • arg (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │

Any

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -default_binop_table: Dict[str, Callable[[Any, Any], Any]] = {'%': <built-in function mod>, '*': <built-in function mul>, '**': <built-in function pow>, '+': <built-in function add>, '-': <built-in function sub>, '/': <built-in function truediv>, '//': <built-in function floordiv>}
│ │ │ +default_binop_table: Dict[str, Callable[[Any, Any], Any]] = {'%': <built-in function mod>, '*': <built-in function mul>, '**': <built-in function pow>, '+': <built-in function add>, '-': <built-in function sub>, '/': <built-in function truediv>, '//': <built-in function floordiv>} │ │ │

default callback table for the binary operators. A copy of this is │ │ │ available on each instance of a sandboxed environment as │ │ │ binop_table

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -default_unop_table: Dict[str, Callable[[Any], Any]] = {'+': <built-in function pos>, '-': <built-in function neg>}
│ │ │ +default_unop_table: Dict[str, Callable[[Any], Any]] = {'+': <built-in function pos>, '-': <built-in function neg>} │ │ │

default callback table for the unary operators. A copy of this is │ │ │ available on each instance of a sandboxed environment as │ │ │ unop_table

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -intercepted_binops: FrozenSet[str] = frozenset({})
│ │ │ +intercepted_binops: FrozenSet[str] = frozenset({}) │ │ │

a set of binary operators that should be intercepted. Each operator │ │ │ that is added to this set (empty by default) is delegated to the │ │ │ call_binop() method that will perform the operator. The default │ │ │ operator callback is specified by binop_table.

│ │ │

The following binary operators are interceptable: │ │ │ //, %, +, *, -, /, and **

│ │ │

The default operation form the operator table corresponds to the │ │ │ @@ -162,15 +162,15 @@ │ │ │

│ │ │

New in version 2.6.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -intercepted_unops: FrozenSet[str] = frozenset({})
│ │ │ +intercepted_unops: FrozenSet[str] = frozenset({}) │ │ │

a set of unary operators that should be intercepted. Each operator │ │ │ that is added to this set (empty by default) is delegated to the │ │ │ call_unop() method that will perform the operator. The default │ │ │ operator callback is specified by unop_table.

│ │ │

The following unary operators are interceptable: +, -

│ │ │

The default operation form the operator table corresponds to the │ │ │ builtin function. Intercepted calls are always slower than the native │ │ │ @@ -189,20 +189,20 @@ │ │ │ starting with an underscore are considered private as well as the │ │ │ special attributes of internal python objects as returned by the │ │ │ is_internal_attribute() function.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • obj (Any) –

  • │ │ │ -
  • attr (str) –

  • │ │ │ +
  • attr (str) –

  • │ │ │
  • value (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

bool

│ │ │ +

bool

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ is_safe_callable(obj)
│ │ │ @@ -211,15 +211,15 @@ │ │ │

This also recognizes the Django convention of setting │ │ │ func.alters_data = True.

│ │ │
│ │ │
Parameters
│ │ │

obj (Any) –

│ │ │
│ │ │
Return type
│ │ │ -

bool

│ │ │ +

bool

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ @@ -232,30 +232,30 @@ │ │ │
Parameters
│ │ │
    │ │ │
  • args (Any) –

  • │ │ │
  • kwargs (Any) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ exception jinja2.sandbox.SecurityError(message=None)
│ │ │

Raised if a template tries to do something insecure if the │ │ │ sandbox is enabled.

│ │ │
│ │ │
Parameters
│ │ │ -

message (Optional[str]) –

│ │ │ +

message (Optional[str]) –

│ │ │
│ │ │
Return type
│ │ │ -

None

│ │ │ +

None

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ jinja2.sandbox.unsafe(f)
│ │ │ @@ -284,19 +284,19 @@ │ │ │ False │ │ │
│ │ │ │ │ │
│ │ │
Parameters
│ │ │
│ │ │
│ │ │
Return type
│ │ │ -

bool

│ │ │ +

bool

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ jinja2.sandbox.modifies_known_mutable(obj, attr)
│ │ │ @@ -318,19 +318,19 @@ │ │ │ False │ │ │ │ │ │ │ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • obj (Any) –

  • │ │ │ -
  • attr (str) –

  • │ │ │ +
  • attr (str) –

  • │ │ │
│ │ │
│ │ │
Return type
│ │ │ -

bool

│ │ │ +

bool

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │

Note

│ │ │

The Jinja sandbox alone is no solution for perfect security. Especially │ │ ├── ./usr/share/doc/python-jinja2-doc/html/templates.html │ │ │ @@ -1438,15 +1438,15 @@ │ │ │

│ │ │ jinja-filters.abs(x, /)
│ │ │

Return the absolute value of the argument.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.attr(environment: 'Environment', obj: Any, name: str) Union[jinja2.runtime.Undefined, Any]
│ │ │ +jinja-filters.attr(environment: 'Environment', obj: Any, name: str) Union[jinja2.runtime.Undefined, Any] │ │ │

Get an attribute of an object. foo|attr("bar") works like │ │ │ foo.bar just that always an attribute is returned and items are not │ │ │ looked up.

│ │ │

See Notes on subscriptions for more details.

│ │ │
│ │ │ │ │ │
│ │ │ @@ -1467,28 +1467,28 @@ │ │ │ </table> │ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.capitalize(s: str) str
│ │ │ +jinja-filters.capitalize(s: str) str │ │ │

Capitalize a value. The first character will be uppercase, all others │ │ │ lowercase.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.center(value: str, width: int = 80) str
│ │ │ +jinja-filters.center(value: str, width: int = 80) str │ │ │

Centers the value in a field of a given width.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.default(value: ~ V, default_value: ~ V = '', boolean: bool = False) ~V
│ │ │ +jinja-filters.default(value: ~ V, default_value: ~ V = '', boolean: bool = False) ~V │ │ │

If the value is undefined it will return the passed default value, │ │ │ otherwise the value of the variable:

│ │ │
{{ my_variable|default('my_variable is not defined') }}
│ │ │  
│ │ │
│ │ │

This will output the value of my_variable if the variable was │ │ │ defined, otherwise 'my_variable is not defined'. If you want │ │ │ @@ -1508,15 +1508,15 @@ │ │ │

d

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.dictsort(value: Mapping[~ K, ~ V], case_sensitive: bool = False, by: 'te.Literal["key", "value"]' = 'key', reverse: bool = False) List[Tuple[~K, ~V]]
│ │ │ +jinja-filters.dictsort(value: Mapping[~ K, ~ V], case_sensitive: bool = False, by: 'te.Literal["key", "value"]' = 'key', reverse: bool = False) List[Tuple[~K, ~V]] │ │ │

Sort a dict and yield (key, value) pairs. Python dicts may not │ │ │ be in the order you want to display them in, so sort them first.

│ │ │
{% for key, value in mydict|dictsort %}
│ │ │      sort the dict by key, case insensitive
│ │ │  
│ │ │  {% for key, value in mydict|dictsort(reverse=true) %}
│ │ │      sort the dict by key, case insensitive, reverse order
│ │ │ @@ -1546,15 +1546,15 @@
│ │ │  

e

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.filesizeformat(value: Union[str, float, int], binary: bool = False) str
│ │ │ +jinja-filters.filesizeformat(value: Union[str, float, int], binary: bool = False) str │ │ │

Format the value like a ‘human-readable’ file size (i.e. 13 kB, │ │ │ 4.1 MB, 102 Bytes, etc). Per default decimal prefixes are used (Mega, │ │ │ Giga, etc.), if the second parameter is set to True the binary │ │ │ prefixes are used (Mebi, Gibi).

│ │ │
│ │ │ │ │ │
│ │ │ @@ -1575,34 +1575,34 @@ │ │ │
│ │ │ jinja-filters.forceescape(value: 't.Union[str, HasHTML]') markupsafe.Markup
│ │ │

Enforce HTML escaping. This will probably double escape variables.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.format(value: str, *args: Any, **kwargs: Any) str
│ │ │ +jinja-filters.format(value: str, *args: Any, **kwargs: Any) str │ │ │

Apply the given values to a printf-style format string, like │ │ │ string % values.

│ │ │
{{ "%s, %s!"|format(greeting, name) }}
│ │ │  Hello, World!
│ │ │  
│ │ │
│ │ │

In most cases it should be more convenient and efficient to use the │ │ │ -% operator or str.format().

│ │ │ +% operator or str.format().

│ │ │
{{ "%s, %s!" % (greeting, name) }}
│ │ │  {{ "{}, {}!".format(greeting, name) }}
│ │ │  
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ jinja-filters.groupby(*args, **kwargs) 't.List[t.Tuple[t.Any, t.List[V]]]'
│ │ │

Group a sequence of objects by an attribute using Python’s │ │ │ -itertools.groupby(). The attribute can use dot notation for │ │ │ +itertools.groupby(). The attribute can use dot notation for │ │ │ nested access, like "address.city". Unlike Python’s groupby, │ │ │ the values are sorted first so only one group is returned for each │ │ │ unique value.

│ │ │

For example, a list of User objects with a city attribute │ │ │ can be rendered in groups. In this example, grouper refers to │ │ │ the city value of the group.

│ │ │
<ul>{% for city, items in users|groupby("city") %}
│ │ │ @@ -1635,15 +1635,15 @@
│ │ │  
│ │ │

Changed in version 2.6: The attribute supports dot notation for nested access.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.indent(s: str, width: Union[int, str] = 4, first: bool = False, blank: bool = False) str
│ │ │ +jinja-filters.indent(s: str, width: Union[int, str] = 4, first: bool = False, blank: bool = False) str │ │ │

Return a copy of the string with each line indented by 4 spaces. The │ │ │ first line and blank lines are not indented by default.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • width – Number of spaces, or a string, to indent by.

  • │ │ │
  • first – Don’t skip indenting the first line.

  • │ │ │ @@ -1670,15 +1670,15 @@ │ │ │ parameter, which handles input with prefixes such as │ │ │ 0b, 0o and 0x for bases 2, 8 and 16 respectively. │ │ │ The base is ignored for decimal numbers and non-string values.

    │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.join(*args, **kwargs) str
│ │ │ +jinja-filters.join(*args, **kwargs) str │ │ │

Return a string which is the concatenation of the strings in the │ │ │ sequence. The separator between elements is an empty string per │ │ │ default, you can define it with the optional parameter:

│ │ │
{{ [1, 2, 3]|join('|') }}
│ │ │      -> 1|2|3
│ │ │  
│ │ │  {{ [1, 2, 3]|join }}
│ │ │ @@ -1721,15 +1721,15 @@
│ │ │  jinja-filters.list(*args, **kwargs)  't.List[V]'
│ │ │  

Convert the value into a list. If it was a string the returned list │ │ │ will be a list of characters.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.lower(s: str) str
│ │ │ +jinja-filters.lower(s: str) str │ │ │

Convert a value to lowercase.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ jinja-filters.map(*args: Any, **kwargs: Any) Iterable
│ │ │

Applies a filter on a sequence of objects or looks up an attribute. │ │ │ @@ -1763,15 +1763,15 @@ │ │ │

│ │ │

New in version 2.7.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.max(environment: 'Environment', value: 't.Iterable[V]', case_sensitive: bool = False, attribute: Union[str, int, NoneType] = None) 't.Union[V, Undefined]'
│ │ │ +jinja-filters.max(environment: 'Environment', value: 't.Iterable[V]', case_sensitive: bool = False, attribute: Union[str, int, NoneType] = None) 't.Union[V, Undefined]' │ │ │

Return the largest item from the sequence.

│ │ │
{{ [1, 2, 3]|max }}
│ │ │      -> 3
│ │ │  
│ │ │
│ │ │
│ │ │
Parameters
│ │ │ @@ -1781,15 +1781,15 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.min(environment: 'Environment', value: 't.Iterable[V]', case_sensitive: bool = False, attribute: Union[str, int, NoneType] = None) 't.Union[V, Undefined]'
│ │ │ +jinja-filters.min(environment: 'Environment', value: 't.Iterable[V]', case_sensitive: bool = False, attribute: Union[str, int, NoneType] = None) 't.Union[V, Undefined]' │ │ │

Return the smallest item from the sequence.

│ │ │
{{ [1, 2, 3]|min }}
│ │ │      -> 1
│ │ │  
│ │ │
│ │ │
│ │ │
Parameters
│ │ │ @@ -1799,15 +1799,15 @@ │ │ │ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.pprint(value: Any) str
│ │ │ +jinja-filters.pprint(value: Any) str │ │ │

Pretty print a variable. Useful for debugging.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ jinja-filters.random(context: 'Context', seq: 't.Sequence[V]') 't.Union[V, Undefined]'
│ │ │

Return a random item from the sequence.

│ │ │ @@ -1852,15 +1852,15 @@ │ │ │
│ │ │

New in version 2.7.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.replace(eval_ctx: 'EvalContext', s: str, old: str, new: str, count: Optional[int] = None) str
│ │ │ +jinja-filters.replace(eval_ctx: 'EvalContext', s: str, old: str, new: str, count: Optional[int] = None) str │ │ │

Return a copy of the value with all occurrences of a substring │ │ │ replaced with a new one. The first argument is the substring │ │ │ that should be replaced, the second is the replacement string. │ │ │ If the optional third argument count is given, only the first │ │ │ count occurrences are replaced:

│ │ │
{{ "Hello World"|replace("Hello", "Goodbye") }}
│ │ │      -> Goodbye World
│ │ │ @@ -1902,15 +1902,15 @@
│ │ │      -> 43
│ │ │  
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.safe(value: str) markupsafe.Markup
│ │ │ +jinja-filters.safe(value: str) markupsafe.Markup │ │ │

Mark the value as safe which means that in an environment with automatic │ │ │ escaping enabled this variable will not be escaped.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ jinja-filters.select(*args: Any, **kwargs: Any) 't.Iterator[V]'
│ │ │ @@ -1977,16 +1977,16 @@ │ │ │ │ │ │

If you pass it a second argument it’s used to fill missing │ │ │ values on the last iteration.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.sort(environment: 'Environment', value: 't.Iterable[V]', reverse: bool = False, case_sensitive: bool = False, attribute: Union[str, int, NoneType] = None) 't.List[V]'
│ │ │ -

Sort an iterable using Python’s sorted().

│ │ │ +jinja-filters.sort(environment: 'Environment', value: 't.Iterable[V]', reverse: bool = False, case_sensitive: bool = False, attribute: Union[str, int, NoneType] = None) 't.List[V]' │ │ │ +

Sort an iterable using Python’s sorted().

│ │ │
{% for city in cities|sort %}
│ │ │      ...
│ │ │  {% endfor %}
│ │ │  
│ │ │
│ │ │
│ │ │
Parameters
│ │ │ @@ -2038,15 +2038,15 @@ │ │ │ Markup('&lt;User 1&gt;') │ │ │ │ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.striptags(value: 't.Union[str, HasHTML]') str
│ │ │ +jinja-filters.striptags(value: 't.Union[str, HasHTML]') str │ │ │

Strip SGML/XML tags and replace adjacent whitespace by one space.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ jinja-filters.sum(*args, **kwargs) ~V
│ │ │

Returns the sum of a sequence of numbers plus the value of parameter │ │ │ @@ -2060,15 +2060,15 @@ │ │ │

Changed in version 2.6: The attribute parameter was added to allow suming up over │ │ │ attributes. Also the start parameter was moved on to the right.

│ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.title(s: str) str
│ │ │ +jinja-filters.title(s: str) str │ │ │

Return a titlecased version of the value. I.e. words will start with │ │ │ uppercase letters, all remaining characters are lowercase.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ jinja-filters.tojson(eval_ctx: 'EvalContext', value: Any, indent: Optional[int] = None) markupsafe.Markup
│ │ │ @@ -2090,21 +2090,21 @@ │ │ │
│ │ │

New in version 2.9.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.trim(value: str, chars: Optional[str] = None) str
│ │ │ +jinja-filters.trim(value: str, chars: Optional[str] = None) str │ │ │

Strip leading and trailing characters, by default whitespace.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.truncate(env: 'Environment', s: str, length: int = 255, killwords: bool = False, end: str = '...', leeway: Optional[int] = None) str
│ │ │ +jinja-filters.truncate(env: 'Environment', s: str, length: int = 255, killwords: bool = False, end: str = '...', leeway: Optional[int] = None) str │ │ │

Return a truncated copy of the string. The length is specified │ │ │ with the first parameter which defaults to 255. If the second │ │ │ parameter is true the filter will cut the text at length. Otherwise │ │ │ it will discard the last word. If the text was in fact │ │ │ truncated it will append an ellipsis sign ("..."). If you want a │ │ │ different ellipsis sign than "..." you can specify it using the │ │ │ third parameter. Strings that only exceed the length by the tolerance │ │ │ @@ -2121,15 +2121,15 @@ │ │ │ │ │ │

The default leeway on newer Jinja versions is 5 and was 0 before but │ │ │ can be reconfigured globally.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.unique(environment: 'Environment', value: 't.Iterable[V]', case_sensitive: bool = False, attribute: Union[str, int, NoneType] = None) 't.Iterator[V]'
│ │ │ +jinja-filters.unique(environment: 'Environment', value: 't.Iterable[V]', case_sensitive: bool = False, attribute: Union[str, int, NoneType] = None) 't.Iterator[V]' │ │ │

Returns a list of unique items from the given iterable.

│ │ │
{{ ['foo', 'bar', 'foobar', 'FooBar']|unique|list }}
│ │ │      -> ['foo', 'bar', 'foobar']
│ │ │  
│ │ │
│ │ │

The unique items are yielded in the same order as their first occurrence in │ │ │ the iterable passed to the filter.

│ │ │ @@ -2141,24 +2141,24 @@ │ │ │ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.upper(s: str) str
│ │ │ +jinja-filters.upper(s: str) str │ │ │

Convert a value to uppercase.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.urlencode(value: Union[str, Mapping[str, Any], Iterable[Tuple[str, Any]]]) str
│ │ │ +jinja-filters.urlencode(value: Union[str, Mapping[str, Any], Iterable[Tuple[str, Any]]]) str │ │ │

Quote data for use in a URL path or query using UTF-8.

│ │ │ -

Basic wrapper around urllib.parse.quote() when given a │ │ │ -string, or urllib.parse.urlencode() for a dict or iterable.

│ │ │ +

Basic wrapper around urllib.parse.quote() when given a │ │ │ +string, or urllib.parse.urlencode() for a dict or iterable.

│ │ │
│ │ │
Parameters
│ │ │

value – Data to quote. A string will be quoted directly. A │ │ │ dict or iterable of (key, value) pairs will be joined as a │ │ │ query string.

│ │ │
│ │ │
│ │ │ @@ -2168,15 +2168,15 @@ │ │ │
│ │ │

New in version 2.7.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.urlize(eval_ctx: 'EvalContext', value: str, trim_url_limit: Optional[int] = None, nofollow: bool = False, target: Optional[str] = None, rel: Optional[str] = None, extra_schemes: Optional[Iterable[str]] = None) str
│ │ │ +jinja-filters.urlize(eval_ctx: 'EvalContext', value: str, trim_url_limit: Optional[int] = None, nofollow: bool = False, target: Optional[str] = None, rel: Optional[str] = None, extra_schemes: Optional[Iterable[str]] = None) str │ │ │

Convert URLs in text into clickable links.

│ │ │

This may not recognize links in some situations. Usually, a more │ │ │ comprehensive formatter, such as a Markdown library, is a better │ │ │ choice.

│ │ │

Works on http://, https://, www., mailto:, and email │ │ │ addresses. Links with trailing punctuation (periods, commas, closing │ │ │ parentheses) and leading punctuation (opening parentheses) are │ │ │ @@ -2212,21 +2212,21 @@ │ │ │

│ │ │

Changed in version 2.8: The target parameter was added.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.wordcount(s: str) int
│ │ │ +jinja-filters.wordcount(s: str) int │ │ │

Count the words in that string.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.wordwrap(environment: 'Environment', s: str, width: int = 79, break_long_words: bool = True, wrapstring: Optional[str] = None, break_on_hyphens: bool = True) str
│ │ │ +jinja-filters.wordwrap(environment: 'Environment', s: str, width: int = 79, break_long_words: bool = True, wrapstring: Optional[str] = None, break_on_hyphens: bool = True) str │ │ │

Wrap a string to the given width. Existing newlines are treated │ │ │ as paragraphs to be wrapped separately.

│ │ │
│ │ │
Parameters
│ │ │
    │ │ │
  • s – Original text to wrap.

  • │ │ │
  • width – Maximum length of wrapped lines.

  • │ │ │ @@ -2248,15 +2248,15 @@ │ │ │
    │ │ │

    Changed in version 2.7: Added the wrapstring parameter.

    │ │ │
    │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-filters.xmlattr(eval_ctx: 'EvalContext', d: Mapping[str, Any], autospace: bool = True) str
│ │ │ +jinja-filters.xmlattr(eval_ctx: 'EvalContext', d: Mapping[str, Any], autospace: bool = True) str │ │ │

Create an SGML/XML attribute string based on the items in a dict. │ │ │ All values that are neither none nor undefined are automatically │ │ │ escaped:

│ │ │
<ul{{ {'class': 'my_list', 'missing': none,
│ │ │          'id': 'list-%d'|format(variable)}|xmlattr }}>
│ │ │  ...
│ │ │  </ul>
│ │ │ @@ -2320,15 +2320,15 @@
│ │ │  

sameas()

│ │ │

upper()

│ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.boolean(value: Any) bool
│ │ │ +jinja-tests.boolean(value: Any) bool │ │ │

Return true if the object is a boolean value.

│ │ │
│ │ │

New in version 2.11.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ @@ -2337,30 +2337,30 @@ │ │ │

Return whether the object is callable (i.e., some kind of function).

│ │ │

Note that classes are callable, as are instances of classes with a │ │ │ __call__() method.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.defined(value: Any) bool
│ │ │ +jinja-tests.defined(value: Any) bool │ │ │

Return true if the variable is defined:

│ │ │
{% if variable is defined %}
│ │ │      value of variable: {{ variable }}
│ │ │  {% else %}
│ │ │      variable is not defined
│ │ │  {% endif %}
│ │ │  
│ │ │
│ │ │

See the default() filter for a simple way to set undefined │ │ │ variables.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.divisibleby(value: int, num: int) bool
│ │ │ +jinja-tests.divisibleby(value: int, num: int) bool │ │ │

Check if a variable is divisible by a number.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ jinja-tests.eq(a, b, /)
│ │ │

Same as a == b.

│ │ │ @@ -2369,36 +2369,36 @@ │ │ │

==, equalto

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.escaped(value: Any) bool
│ │ │ +jinja-tests.escaped(value: Any) bool │ │ │

Check if the value is escaped.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.even(value: int) bool
│ │ │ +jinja-tests.even(value: int) bool │ │ │

Return true if the variable is even.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.false(value: Any) bool
│ │ │ +jinja-tests.false(value: Any) bool │ │ │

Return true if the object is False.

│ │ │
│ │ │

New in version 2.11.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.filter(env: 'Environment', value: str) bool
│ │ │ +jinja-tests.filter(env: 'Environment', value: str) bool │ │ │

Check if a filter exists by name. Useful if a filter may be │ │ │ optionally available.

│ │ │
{% if 'markdown' is filter %}
│ │ │      {{ value | markdown }}
│ │ │  {% else %}
│ │ │      {{ value }}
│ │ │  {% endif %}
│ │ │ @@ -2407,15 +2407,15 @@
│ │ │  
│ │ │

New in version 3.0.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.float(value: Any) bool
│ │ │ +jinja-tests.float(value: Any) bool │ │ │

Return true if the object is a float.

│ │ │
│ │ │

New in version 2.11.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ @@ -2438,33 +2438,33 @@ │ │ │

>, greaterthan

│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.in(value: Any, seq: Container) bool
│ │ │ +jinja-tests.in(value: Any, seq: Container) bool │ │ │

Check if value is in seq.

│ │ │
│ │ │

New in version 2.10.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.integer(value: Any) bool
│ │ │ +jinja-tests.integer(value: Any) bool │ │ │

Return true if the object is an integer.

│ │ │
│ │ │

New in version 2.11.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.iterable(value: Any) bool
│ │ │ +jinja-tests.iterable(value: Any) bool │ │ │

Check if it’s possible to iterate over an object.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ jinja-tests.le(a, b, /)
│ │ │

Same as a <= b.

│ │ │ @@ -2473,15 +2473,15 @@ │ │ │

<=

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.lower(value: str) bool
│ │ │ +jinja-tests.lower(value: str) bool │ │ │

Return true if the variable is lowercased.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ jinja-tests.lt(a, b, /)
│ │ │

Same as a < b.

│ │ │ @@ -2490,15 +2490,15 @@ │ │ │

<, lessthan

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.mapping(value: Any) bool
│ │ │ +jinja-tests.mapping(value: Any) bool │ │ │

Return true if the object is a mapping (dict etc.).

│ │ │
│ │ │

New in version 2.6.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │ @@ -2510,58 +2510,58 @@ │ │ │

!=

│ │ │
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.none(value: Any) bool
│ │ │ +jinja-tests.none(value: Any) bool │ │ │

Return true if the variable is none.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.number(value: Any) bool
│ │ │ +jinja-tests.number(value: Any) bool │ │ │

Return true if the variable is a number.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.odd(value: int) bool
│ │ │ +jinja-tests.odd(value: int) bool │ │ │

Return true if the variable is odd.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.sameas(value: Any, other: Any) bool
│ │ │ +jinja-tests.sameas(value: Any, other: Any) bool │ │ │

Check if an object points to the same memory address than another │ │ │ object:

│ │ │
{% if foo.attribute is sameas false %}
│ │ │      the foo attribute really is the `False` singleton
│ │ │  {% endif %}
│ │ │  
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.sequence(value: Any) bool
│ │ │ +jinja-tests.sequence(value: Any) bool │ │ │

Return true if the variable is a sequence. Sequences are variables │ │ │ that are iterable.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.string(value: Any) bool
│ │ │ +jinja-tests.string(value: Any) bool │ │ │

Return true if the object is a string.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.test(env: 'Environment', value: str) bool
│ │ │ +jinja-tests.test(env: 'Environment', value: str) bool │ │ │

Check if a test exists by name. Useful if a test may be │ │ │ optionally available.

│ │ │
{% if 'loud' is test %}
│ │ │      {% if value is loud %}
│ │ │          {{ value|upper }}
│ │ │      {% else %}
│ │ │          {{ value|lower }}
│ │ │ @@ -2574,30 +2574,30 @@
│ │ │  
│ │ │

New in version 3.0.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.true(value: Any) bool
│ │ │ +jinja-tests.true(value: Any) bool │ │ │

Return true if the object is True.

│ │ │
│ │ │

New in version 2.11.

│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.undefined(value: Any) bool
│ │ │ +jinja-tests.undefined(value: Any) bool │ │ │

Like defined() but the other way round.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ -jinja-tests.upper(value: str) bool
│ │ │ +jinja-tests.upper(value: str) bool │ │ │

Return true if the variable is uppercased.

│ │ │
│ │ │ │ │ │ │ │ │
│ │ │

List of Global Functions

│ │ │

The following functions are available in the global scope by default: