jinja2.nodes.For

class jinja2.nodes.For(*fields, **attributes)[source]

The for loop. target is the target for the iteration (usually a Name or Tuple), iter the iterable. body is a list of nodes that are used as loop-body, and else_ a list of nodes for the else block. If no else node exists it has to be an empty list.

For filtered nodes an expression can be stored as test, otherwise None.

Methods

__init__(*fields, **attributes)
find(node_type) Find the first node of a given type.
find_all(node_type) Find all the nodes of a given type.
iter_child_nodes([exclude, only]) Iterates over all direct child nodes of the node.
iter_fields([exclude, only]) This method iterates over all fields that are defined and yields (key, value) tuples.
set_ctx(ctx) Reset the context of a node and all child nodes.
set_environment(environment) Set the environment for all nodes.
set_lineno(lineno[, override]) Set the line numbers of the node and children.