Expression Engine
An instance of this class keeps a mutable collection of expression type handlers. It can compile expression strings by delegating to these handlers. It can provide an expression Context, which is capable of holding state and evaluating compiled expressions.
There are no attributes in this class.
compile(expression)
getBaseNames()
getCompilerError()
getContext(contexts=None, **kwcontexts)
getFunctionNamespace(namespacename)
Returns the function namespace
getTypes()
registerBaseName(name, object)
registerFunctionNamespace(namespacename, namespacecallable)
Register a function namespace
parameter:
This callable should return an object which can be traversed to get the functions provided by the this namespace.
example:
class stringFuncs(object):
- def __init__(self,context):
- self.context = str(context)
- def upper(self):
- return self.context.upper()
- def lower(self):
- return self.context.lower()
engine.registerFunctionNamespace('string',stringFuncs)
registerType(name, handler)