jinja2

jinja2

Jinja2 is a template engine written in pure Python. It provides a Django inspired non-XML syntax but supports inline expressions and an optional sandboxed environment.

Nutshell

Here a small example of a Jinja2 template:

{% extends 'base.html' %}
{% block title %}Memberlist{% endblock %}
{% block content %}
  <ul>
  {% for user in users %}
    <li><a href="{{ user.url }}">{{ user.username }}</a></li>
  {% endfor %}
  </ul>
{% endblock %}
copyright:
  1. 2010 by the Jinja Team.
license:

BSD, see LICENSE for more details.

Modules

_markupsafe markupsafe
_stringdefs jinja2._stringdefs
bccache jinja2.bccache
compiler jinja2.compiler
constants jinja.constants
debug jinja2.debug
defaults jinja2.defaults
environment jinja2.environment
exceptions jinja2.exceptions
ext jinja2.ext
filters jinja2.filters
lexer jinja2.lexer
loaders jinja2.loaders
meta jinja2.meta
nodes jinja2.nodes
optimizer jinja2.optimizer
parser jinja2.parser
runtime jinja2.runtime
sandbox jinja2.sandbox
tests jinja2.tests
utils jinja2.utils
visitor jinja2.visitor

Exceptions

TemplateAssertionError(message, lineno[, ...]) 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.
TemplateError([message]) Baseclass for all template errors.
TemplateNotFound(name[, message]) Raised if a template does not exist.
TemplateSyntaxError(message, lineno[, name, ...]) Raised to tell the user that there is a problem with the template.
TemplatesNotFound([names, message]) Like TemplateNotFound but raised if multiple templates
UndefinedError([message]) Raised if a template tries to operate on Undefined.

Table Of Contents

Previous topic

UndefinedError

Next topic

jinja2._markupsafe