This module implements additional nodes derived from the ast base node.

It also provides some node tree helper functions like in_lineno and get_nodes used by the parser and translator in order to normalize python and jinja nodes.

  1. 2010 by the Jinja Team.

BSD, see LICENSE for more details.


Add Add the left to the right node.
And Short circuited AND.
Assign Assigns an expression to a target.
BinExpr Baseclass for all binary expressions.
Block A node that represents a block.
Break Break a loop.
Call Calls an expression.
CallBlock Like a macro without a name but a call instead.
Compare Compares an expression with some other expressions.
Concat Concatenates the list of expressions provided after converting them to
CondExpr A conditional expression (inline if expression).
Const All constant values.
ContextReference Returns the current template context.
Continue Continue a loop.
Dict Any dict literal such as {1: 2, 3: 4}.
Div Divides the left by the right node.
EnvironmentAttribute Loads an attribute from the environment object.
EvalContext Holds evaluation time information.
EvalContextModifier Modifies the eval context.
Expr Baseclass for all expressions.
ExprStmt A statement that evaluates an expression and discards the result.
Extends Represents an extends statement.
ExtensionAttribute Returns the attribute of an extension bound to the environment.
Filter This node applies a filter on an expression.
FilterBlock Node for filter sections.
FloorDiv Divides the left by the right node and truncates conver the
For The for loop.
FromImport A node that represents the from import tag.
Getattr Get an attribute or item from an expression that is a ascii-only
Getitem Get an attribute or item from an expression and prefer the item.
Helper Nodes that exist in a specific context only.
If If test is true, body is rendered, else else_.
Import A node that represents the import tag.
ImportedName If created with an import name the import name is returned on node access.
Include A node that represents the include tag.
InternalName An internal name in the compiler.
Keyword A key, value pair for keyword arguments where key is a string.
List Any list literal such as [1, 2, 3]
Literal Baseclass for literals.
Macro A macro definition.
MarkSafe Mark the wrapped expression as safe (wrap it as Markup).
MarkSafeIfAutoescape Mark the wrapped expression as safe (wrap it as Markup) but
Mod Left modulo right.
Mul Multiplies the left with the right node.
Name Looks up a name or stores a value in a name.
Neg Make the expression negative.
Node Baseclass for all Jinja2 nodes. There are a number of nodes available
NodeType A metaclass for nodes that handles the field and attribute inheritance.
Not Negate the expression.
Operand Holds an operator and an expression.
Or Short circuited OR.
Output A node that holds multiple expressions which are then printed out.
Pair A key, value pair for dicts.
Pos Make the expression positive (noop for most expressions)
Pow Left to the power of right.
Scope An artificial scope.
ScopedEvalContextModifier Modifies the eval context and reverts it later.
Slice Represents a slice object.
Stmt Base node for all statements.
Sub Substract the right from the left node.
Template Node that represents a template.
TemplateData A constant template string.
Test Applies a test on an expression.
Tuple For loop unpacking and some other things like multiple arguments for subscripts.
UnaryExpr Baseclass for all unary expressions.


Impossible Raised if the node could not perform a requested action.


get_eval_context(node, ctx)


  • FunctionType
  • Markup
  • MethodType
  • chain
  • deque
  • izip
  • operator

Table Of Contents

Previous topic


Next topic

Add Class