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

Steve Alexander steve@cat-box.net
Wed, 12 Jul 2000 12:22:37 +0100


Chris Withers wrote:
> 
> I was trying to use 'if o in REQUEST.PARENTS' to expand branches on the
> way to the currently displayed object and was running into trouble which
> lead me to try out the following code:
> 
> `REQUEST.PARENTS[0]`+`o`+`o==REQUEST.PARENTS[0]`+`o is
> REQUEST.PARENTS[0]`
> 
> Now, this renders the following in the case where the branch _should_
> expand:
> <Folder instance at 88cbb30><Folder instance at 88cbb30>00
> 
> What I don't understand is how two objects, apparently at the same
> memory location, return false from both 'object1==object2' and 'object1
> is object2'.

Smells like an Acquisition Wrapper misunderstanding :-)

 
http://www.zope.org/Members/michel/Projects/Interfaces/AcquisitionWrappedObject


Use the aq_self or aq_parent attribute to do your comparisons to get
your object out of its magic acquisition wrapper.


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