module documentation

Parser and utilities for the smart 'if' tag
Constant OPERATORS Undocumented
Class ​End​Token Undocumented
Class ​If​Parser Undocumented
Class ​Literal A basic self-resolvable object similar to a Django template variable.
Class ​Token​Base Base class for operators and literals, mainly for debugging and for throwing syntax errors.
Function infix Create an infix operator, given a binding power and a function that evaluates the node.
Function prefix Create a prefix operator, given a binding power and a function that evaluates the node.
OPERATORS =

Undocumented

Value
{'or': infix(6, (lambda context, x, y: x.eval(context) or y.eval(context))),
 'and': infix(7, (lambda context, x, y: x.eval(context) and y.eval(context))),
 'not': prefix(8, (lambda context, x: not x.eval(context))),
 'in': infix(9, (lambda context, x, y: x.eval(context) in y.eval(context))),
 'not in': infix(9,
                 (lambda context, x, y: x.eval(context) not in y.eval(context)))
,
...
def infix(bp, func):
Create an infix operator, given a binding power and a function that evaluates the node.
def prefix(bp, func):
Create a prefix operator, given a binding power and a function that evaluates the node.