jinja2.runtime¶
Runtime helpers.
copyright: |
|
---|---|
license: | BSD. |
Functions¶
concat |
S.join(iterable) -> unicode |
escape ((s) -> markup) |
Convert the characters &, <, >, ‘, and ” in string s to HTML-safe sequences. |
identity (x) |
the identity function. Useful for certain things in the environment |
implements_iterator (cls) |
|
implements_to_string (cls) |
|
internalcode (f) |
Marks the function as internally used |
iteritems (d) |
|
make_logging_undefined ([logger, base]) |
Given a logger object this returns a new undefined class that will log certain failures. |
markup_join (seq) |
Concatenation that escapes if necessary and converts to unicode. |
new_context (environment, template_name, blocks) |
Internal helper to for context creation. |
object_type_repr (obj) |
Returns the name of the object’s type. |
soft_unicode ((object) -> string) |
Make a string unicode if it isn’t already. |
unicode_join (seq) |
Simple args to unicode conversion and concatenation. |
Classes¶
BlockReference (name, context, stack, depth) |
One block on a template reference. |
Context (environment, parent, name, blocks) |
The template context holds the variables of a template. |
DebugUndefined ([hint, obj, name, exc]) |
An undefined that returns the debug info when printed. |
EvalContext (environment[, template_name]) |
Holds evaluation time information. |
LoopContext (iterable[, recurse, depth0]) |
A loop context for dynamic iteration. |
LoopContextIterator (context) |
The iterator for a loop context. |
Macro (environment, func, name, arguments, ...) |
Wraps a macro function. |
Mapping |
A Mapping is a generic container for associating key/value pairs. |
Markup |
Marks a string as being safe for inclusion in HTML/XML output without needing to be escaped. |
StrictUndefined ([hint, obj, name, exc]) |
An undefined that barks on print and iteration as well as boolean tests and all kinds of comparisons. |
TemplateReference (context) |
The self in templates. |
Undefined ([hint, obj, name, exc]) |
The default undefined type. |
chain |
chain(*iterables) –> chain object |
imap |
imap(func, *iterables) –> imap object |
text_type |
alias of unicode |
to_string |
alias of unicode |
Exceptions¶
TemplateNotFound (name[, message]) |
Raised if a template does not exist. |
TemplateRuntimeError ([message]) |
A generic runtime error in the template engine. |
UndefinedError ([message]) |
Raised if a template tries to operate on Undefined . |