jinja2.environment¶
Provides a class that holds runtime and parsing time options.
copyright: |
|
---|---|
license: | BSD, see LICENSE for more details. |
Functions¶
concat |
S.join(iterable) -> unicode |
consume (iterable) |
Consumes an iterable without doing anything with it. |
copy_cache (cache) |
Create an empty copy of the given cache. |
create_cache (size) |
Return the cache class for the given size. |
encode_filename (filename) |
|
generate (node, environment, name, filename) |
Generate the python source for a node tree. |
get_lexer (environment) |
Return a lexer which is probably cached. |
get_next (x) |
|
get_spontaneous_environment (*args) |
Return a new spontaneous environment. |
implements_iterator (cls) |
|
implements_to_string (cls) |
|
import_string (import_name[, silent]) |
Imports an object based on a string. |
internalcode (f) |
Marks the function as internally used |
iteritems (d) |
|
load_extensions (environment, extensions) |
Load the extensions from the list and bind it to the environment. |
new_context (environment, template_name, blocks) |
Internal helper to for context creation. |
optimize (node, environment) |
The context hint can be used to perform an static optimization based on the context given. |
reduce ((function, sequence[, initial]) -> value) |
Apply a function of two arguments cumulatively to the items of a sequence, from left to right, so as to reduce the sequence to a single value. |
reraise (tp, value[, tb]) |
Classes¶
CodeGenerator (environment, name, filename[, ...]) |
|
Context (environment, parent, name, blocks) |
The template context holds the variables of a template. |
Environment ([block_start_string, ...]) |
The core component of Jinja is the Environment. |
EvalContext (environment[, template_name]) |
Holds evaluation time information. |
LRUCache (capacity) |
A simple LRU Cache implementation. |
Markup |
Marks a string as being safe for inclusion in HTML/XML output without needing to be escaped. |
Parser (environment, source[, name, ...]) |
This is the central parsing class Jinja2 uses. |
Template |
The central template object. |
TemplateExpression (template, undefined_to_none) |
The jinja2.Environment.compile_expression() method returns an instance of this object. |
TemplateModule (template, context) |
Represents an imported template. |
TemplateStream (gen) |
A template stream works pretty much like an ordinary python generator but it can buffer multiple items to reduce the number of total iterations. |
TokenStream (generator, name, filename) |
A token stream is an iterable that yields Token s. |
Undefined ([hint, obj, name, exc]) |
The default undefined type. |
ifilter |
ifilter(function or None, sequence) –> ifilter object |
imap |
imap(func, *iterables) –> imap object |
text_type |
alias of unicode |
Exceptions¶
TemplateNotFound (name[, message]) |
Raised if a template does not exist. |
TemplateRuntimeError ([message]) |
A generic runtime error in the template engine. |
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 are selected. |