[Zope] Getting REQUEST in product method by default

Kevin Smith Kevin.Smith@theMorgue.org
Thu, 31 Jan 2002 19:34:36 -0500


I am writing a Zope product that wraps a non-Zope Python class.  I
would like to mirror some of the methods of this class in the Zope
wrapper class, but have them only accept the REQUEST and RESPONSE
variables.  For example,

class MyClass:
    """ Normal class """
    def getData(self, user, field):
       ...

class ZMyClass(MyClass, Folder):
    """ Zope Folder subclass """
    def getData(self, REQUEST, RESPONSE=None):
       ... validate REQUEST variables ...
       return MyClass.getData(REQUEST['user'], REQUEST['field'])

I want to do this because I thought that I could then do a simple

<dtml-var getData>

to get the result of the ZMyClass.getData method, but this doesn't
seem to work.  I don't know how the innards of Zope work, but I
thought that methods called in this way were always given the REQUEST
varible.  I keep getting REQUEST=None.  Is it possible to do this?

Kevin Smith