Logo Search packages:      
Sourcecode: zope-loginmanager version File versions

ZPatterns::Expressions Namespace Reference

Detailed Description

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

       # compute the result 
       result = Expression(someString).eval(md)
       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.


class  Expression
class  Name
class  NamespaceStack


def popProxy
def pushProxy

Generated by  Doxygen 1.6.0   Back to index