[Zope] Re: Can't use aq_parent in Product??

Paul Winkler slinkp23@yahoo.com
Sun, 11 Nov 2001 23:34:02 -0500


On Sun, Nov 11, 2001 at 09:05:41PM -0500, Paul Winkler wrote:
(snip)
> So I guess I need to get an acquisition wrapper to self, so I can
> acquire its parent? How do I do that? I can't figure it out from the
> DevGuide.  Or Is there a less bletcherous solution?

I figured it out... the solution is right there in the DevGuide,
though it doesn't have exactly this example:

def __init__(...):
    ...
    aqwrapper = self.__of__(self)
    parent = aqwrapper.aq_parent

Now parent is the parent folder of self. Cool.

Of course I immediately realized that I don't need this solution at
all. {:-l I wanted to conditionally create another object in the
parent folder during __init__(), but it finally dawned on me that the
easy way to do that is to do it during the manage_addMyProduct() call,
in which the *folder* is already available as "self". Duh. Much
easier. And it works.

--

paul winkler
home:  http://www.slinkp.com
music: http://www.reacharms.com
calendars: http://www.calendargalaxy.com