[Zope-dev] Python method wrapping around DTML method

maxm maxm@mxm.dk
Fri, 03 Jan 2003 23:16:39 +0100


Bjorn Stabell wrote:

> in such a way that DTMLFunc gets everything it needs, e.g., namespace,
> but PlainFunc can do funky things to this namespace before-hand (like
> insert a few variables into it).  In other words, I want a Python method
> to wrap around a DTML method.


It is pretty simple:

class myProduct:

     # The dtml object
     DtmlFunc = HTMLFile('DtmlFunc', globals())

     # to call it
     def PlainFunc(self):
         "Remember docstring"
         extraParameter = 'Some string'
         return self.DtmlFunc(self, self.REQUEST,
                         extraParameter=extraParameter)


regvards Max M