[Zope] Re: Why do I get an attribute error when one tool calls anothertool?

Jens Vagelpohl jens at dataflake.org
Mon Dec 6 02:30:31 EST 2004


> 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")

That looks like a nasty workaround for something that you really should 
be doing in manage_afterAdd.

jens



More information about the Zope mailing list