Re: [Zope] Re: Getting a methods parent (in a product)

2005-07-25 Thread Chris Withers
Tres Seaver wrote: The actual issue is that attribute access will break if you have an unwrapped object; 'aq_parent(foo)' will return 'None' in that case. AttributeError: aq_parent AttributeEror: None has no attribute "myattribute" Take your pick I guess ;-) *grinz* Chris -- Simplistix -

[Zope] Re: Getting a methods parent (in a product)

2005-07-24 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jens Vagelpohl wrote: > > On 23 Jul 2005, at 16:12, Peter Bengtsson wrote: > >>> from Acquisition import aq_inner, aq_parent >>> >>> parent = aq_parent(aq_inner(self)) >>> >>> This will return the true container the instance is set in, not just >>> t

[Zope] Re: Getting a methods parent (in a product)

2005-07-23 Thread Jens Vagelpohl
On 23 Jul 2005, at 16:12, Peter Bengtsson wrote: from Acquisition import aq_inner, aq_parent parent = aq_parent(aq_inner(self)) This will return the true container the instance is set in, not just the acquisition parent. What's so bad about parent = self.aq_parent Two things: - simply us

[Zope] Re: Getting a methods parent (in a product)

2005-07-23 Thread Peter Bengtsson
> > > > How can I get a Product instance's _actual_ parent when one of its > > methods is called? (In other ways: how can I find out, from an > > instance, where that instance is located without falling prey to > > acquisition in Zope 2?) > > from Acquisition import aq_inner, aq_parent > > parent