[Zope] Re: Why do I get an attribute error when one tool calls
anothertool?
Josef Meile
jmeile at hotmail.com
Mon Dec 6 01:08:07 EST 2004
Hi Peter,
> getToolByName depends on acquisition to work, and the one
> place that it doesn't work is in a constructor ;)
Yes, that's true, but I think you can make it work if you
pass the REQUEST (or I think the object itself) that calls
the init method. ie:
def manage_addMyProduct(self, p1, p2, ..., REQUEST=None, submit=None):
"""Method that is called to create an instance on the zope db"""
#Do something here
#Then create the object:
myObj=MyProduct(self,p1,p2)
self._setObject(id,boringObj)
#Do request redirection things here
class MyProduct:
def __init__(self, callerObj, p1, p2):
"""Inits your product"""
ppt=getToolByName(callerObj,"parasynpip_tool")
I don't know if it is the right sintax, but once I did something
similar. If I'm not wrong, it is on the book of Dieter, or it is
on a message that he posted.
Regards,
Josef
More information about the Zope
mailing list