module documentation

Parser and utilities for the smart 'if' tag

Class EndToken Undocumented
Class IfParser Undocumented
Class Literal A basic self-resolvable object similar to a Django template variable.
Class TokenBase 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.
Constant OPERATORS Undocumented
def infix(bp, func): (source)

Create an infix operator, given a binding power and a function that evaluates the node.

def prefix(bp, func): (source)

Create a prefix operator, given a binding power and a function that evaluates the node.

OPERATORS = (source)

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)))
,
...