[Zope-DB] Calling a Product method from a ZSQL Method

Dieter Maurer dieter at handshake.de
Thu Nov 27 18:53:11 EST 2003

Santi Camps wrote at 2003-11-26 18:14 +0100:
 > I've created a class inheriting from ZSQL Methods.  Now I would like to
 > call a public method defined in this class from ZSQL code, but I'm not
 > able to do it.  I can call methods from parent objects, but not my own
 > class methods.


It comes from this code in "Shared.DC.ZRDB.DA.DA.__call__":

        if hasattr(self, 'aq_parent'):
            if self._isBeingAccessedAsZClassDefinedInstanceMethod():
        else: p=None

	## thus, "p" is either the parent or "None"

            try:     query=apply(self.template, (p,), argdata)
	    ## this calls the template -- with "p" rather than "self"
	    ## as "client"
	    ## this explains why you can access the parents methods
	    ## but not that of the Z SQL Method itself

I have no idea why this was implemented this way -- maybe
in order to be consistent with "DTML Methods"
They ignore the method itself and start
with the parent as top element on the DTML namespace.


More information about the Zope-DB mailing list