[Zope-dev] Re: Another mystery for you ;-)

Steve Alexander steve@cat-box.net
Wed, 12 Jul 2000 13:34:40 +0100


Chris Withers wrote:
> 
> 
> Two questions:
> 
> 1. Is there a better way of doing the above?

Does the method aq_inContextOf() do what you want?

http://www.zope.org/Members/michel/Projects/Interfaces/AcquisitionWrappedObject
----
aq_inContextOf(other [, inner])

Check whether the object is in the context of another object, other,
meaning that the other object is in the acquisition hierarchy abovethe
object.

An optional argument, inner, can be provided to indicate wither the
innermost wrapped object should be checked.
----

> 2. Is there any case where a Zope object isn't going to have a .aq_base
>    attribute?

I don't think there is any such case generally, as all Zope objects
support acquisition, and therefore inherit from Acquisition.Implicit or
Acquisition.Explicit.

However, someone could write a Product with a class that doesn't support
Acquisition. I think I'd consider that a bug in their Product, though.


--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net