[Zope] Re: Acquisition not working for me
Jim Anderson
ezjab at ieee.org
Tue Sep 28 10:03:14 EDT 2004
Hi Tres,
Thank you for the advice. Unfortunately, in Zope 2.7.1, in ObjectManager.py
there is no method named getObject(). I searched for getObject in other
files, but only got a hit in App/Extensions.py which does not seem
appropropriate.
In ObjectManager, I also found the method _getOb(), but I'm not sure
on the wisdom of using this method.
I do have a simple work around that is not too elegant, but will work,
so please don't spend much time on this issue. However, if you have
a quick response, please let me know since your solution would be
of more general use to me in the future.
Jim
Tres Seaver wrote:
> 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.
More information about the Zope
mailing list