Expression Engine

class zope.tales.tales.Context(engine, contexts)[source]

Bases: object

Expression engine, an implementation of zope.tal.interfaces.ITALExpressionEngine.

This class is called Context because an instance of this class holds context information (namespaces) that it uses when evaluating compiled expressions.

Parameters:
  • engine – A ExpressionEngine (a zope.tal.interfaces.ITALExpressionCompiler)
  • contexts – A mapping (namespace) of variables that forms the base variable scope.
setContext(name, value)[source]

Hook to allow subclasses to do things like adding security proxies.

evaluate(expression)[source]

Evaluate the expression by calling it, passing in this object, and return the raw results.

If expression is a string, it is first compiled.

evaluateValue(expression)

Evaluate the expression by calling it, passing in this object, and return the raw results.

If expression is a string, it is first compiled.

evaluateBoolean(expr)[source]

Evaluate the expression and return the boolean value of its result.

evaluateStructure(expression)

Evaluate the expression by calling it, passing in this object, and return the raw results.

If expression is a string, it is first compiled.

evaluateMacro(expression)

Evaluate the expression by calling it, passing in this object, and return the raw results.

If expression is a string, it is first compiled.

Exceptions

A number of exceptions are defined.

class zope.tales.tales.TALESError[source]

Bases: exceptions.Exception

Error during TALES evaluation

class zope.tales.tales.Undefined[source]

Bases: zope.tales.tales.TALESError

Exception raised on traversal of an undefined path

class zope.tales.tales.CompilerError[source]

Bases: exceptions.Exception

TALES Compiler Error

class zope.tales.tales.RegistrationError[source]

Bases: exceptions.Exception

Expression type or base name registration Error