Tayra

Template. Script. Distribute

defaultpy – Substitute Python expressions

Provides default expression evaluator and a common set of filtering methods. Evaluates python expression.

Module contents

class tayra.expr.defaultpy.ExpressionPy(pa, *args, **kwargs)[source]

Bases: pluggdapps.plugin.Plugin

Plugin evaluates python expression, converts the result into string and supplies escape filtering like url-encode, xml-encode, html-encode, stripping whitespaces on expression substitution.

default(mach, text)[source]

Default handler. Return None so that runtime will try other plugins implementing the filter.

eval(mach, text, globals_, locals_)[source]

tayra.interfaces.ITayraExpression.eval() interface method.

filter(mach, name, text)[source]

tayra.interfaces.ITayraExpression.filter() interface method.

h(mach, text)[source]

Assume text as HTML and apply html.escape( quote=True )

t(mach, text)[source]

Strip whitespaces before and after text using strip()

u(mach, text)[source]

Assume text as url and quote using urllib.parse.quote()

x(mach, text)[source]

Assume text as XML, and apply escape encoding.