Utilties for computing DTML (restricted Python) Expressions This module exports everything you need to set up and call DTML expressions, including pickle-able (but not Persistent) Expression and Name lookup classes. The general usage pattern looks like this:: from Products.ZPatterns.Expressions import * md = NamespaceStack() # make a namespace stack i = InstanceDict(object, md) # prepare an object for pushing onto stack md._push(i) # push it on the stack getSecurityManager().addContext(self) # add owner mask/proxy roles try: # compute the result result = Expression(someString).eval(md) finally: getSecurityManager().removeContext(self) # remove security context md._pop() # remove pushed object Of course, if you need to place other data on the stack, your actual code will vary. Also, it is more likely that you will store 'Expression(someString)' as an attribute of your own objects, and simply call its '.eval()' method when you need it, in order to avoid excessive recompiling of the same expression. Note: The 'pushProxy(ob)' and 'popProxy(ob)' routines are simple synonyms for 'getSecurityManager().addContext(ob)' and 'getSecurityManager().removeContext(ob)', respectively. They were originally created to mask the differences between Zope 2.1.x and 2.2.x, and so should be avoided when writing new code.