Expression Implementations¶
Basic Page Template expression types.
Expression objects are created by the ExpressionEngine
(they must have previously been registered with
registerType()). The expression object itself
is a callable object taking one argument, econtext, which is the local
expression namespace.
-
zope.tales.expressions.simpleTraverse(object, path_items, econtext)[source]¶ Traverses a sequence of names, first trying attributes then items.
-
class
zope.tales.expressions.SubPathExpr(path, traverser, engine)[source]¶ Bases:
objectImplementation of a single path expression.
-
class
zope.tales.expressions.PathExpr(name, expr, engine, traverser=<function simpleTraverse>)[source]¶ Bases:
objectOne or more
subpath expressions, separated by|.
-
class
zope.tales.expressions.StringExpr(name, expr, engine)[source]¶ Bases:
objectAn expression that produces a string.
Sub-sequences of the string that begin with
$are interpreted as path expressions to evaluate.
-
class
zope.tales.expressions.NotExpr(name, expr, engine)[source]¶ Bases:
objectAn expression that negates the boolean value of its sub-expression.
-
class
zope.tales.expressions.DeferExpr(name, expr, compiler)[source]¶ Bases:
objectAn expression that will defer evaluation of the sub-expression until necessary, preserving the execution context it was created with.
This is useful in
tal:defineexpressions:<div tal:define="thing defer:some/path"> ... <!-- some/path is only evaluated if condition is true --> <span tal:condition="condition" tal:content="thing"/> </div>
-
class
zope.tales.expressions.LazyWrapper(expr, econtext)[source]¶ Bases:
zope.tales.expressions.DeferWrapperWrapper for lazy: expression
-
class
zope.tales.expressions.LazyExpr(name, expr, compiler)[source]¶ Bases:
zope.tales.expressions.DeferExprAn expression that will defer evaluation of its sub-expression until the first time it is necessary.
This is like
DeferExpr, but caches the result of evaluating the expression.