[Zope] Re: Acquisition not working for me

Tres Seaver tseaver at zope.com
Fri Sep 24 09:43:35 EDT 2004


Jim Anderson wrote:

> I have a problem working with acquisition. I'm working with
> python classes in Zope 2.7.1. These class are zope objects.
> 
> My class structure has class F derived from Folder
> and class I derived from SimpleItem.
> 
> An instance of I is created in class F and then
> a call to setObject is made with the id and handle
> to the instance of I.
> 
> When I bring up zope, the instance of I shows up
> in the folder, as expected.
> 
> However, if I execute self.absolute_url_path()
> in I, it does not return a full path, only the id
> of the instance object. When I step through
> the absolute_url_path source code, I find that
> the instance of I does not have an attribute
> for self.aq_parent. I was surprised at this because
> I is a SimpleItem which in turn is derived
> from Acquisition.
> 
> Am I mistaken in my expectation that instance
> I would have an aq_parent that is the folder that
> contains it?

It sounds as though you still have the original, unwrapped I object. 
You neet to get your I object back out of your F folder *after* storing 
it.  E.g.:

   f = F(...)
   i = I(...)
   f._setObject('name', i)
   i = f.getObject('name)  # now it is wrapped

Tres.
-- 
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com



More information about the Zope mailing list