[Zope] Bitten by == ;-)

Chris Withers chrisw@nipltd.com
Tue, 05 Sep 2000 09:18:59 +0100


Andy Dustman wrote:
> I have a DTML Method (build_navigation_bar) that is called from
> standard_html_header to (surprise) build a navigation
> bar. 

Word from the (pretending to be ;-) wise: Do it in an external method...
I've got one that probably does 90% of what you want. Mail me off list
if you're interested...

>   <!-- this() in parents == <dtml-var "this() in parents"> ==
>        <dtml-var this> in <dtml-var parents> -->
>   <dtml-if "this() in parents">

> Unfortunately, this doesn't work: The conditional is always false. Some of
> the debugging output:
> 
> <!-- this() in parents == 0 == <Folder instance at 89d9850> in
> [<Folder instance at 87b2cc8>, <Folder instance at 8a22420>, <Application
> instance at 87b9158>] -->
> <!-- this() in parents == 0 == <Folder instance at 87b2cc8> in
> [<Folder instance at 87b2cc8>, <Folder instance at 8a22420>, <Application
> instance at 87b9158>] -->
> 
> Note that in the first line, the expression correctly evaluates to 0,
> while the second line incorrectly evaluates to 0.

*grinz* f*^*ing confusing isn't it. I did much head scratching until
someone helpful pointed out you're dealing with acquisition wrappers:

http://zope.nipltd.com/public/lists/dev-archive.nsf/ByKey/08240A8E0D50AEE0

...that might cover what you're looking for and that whole thread
discusses the related issues.

Jim suggested it wouldn't be hard to implement == to 'ignore' these
wrappers and I'd love to give it a go but sadly:
- I haven't written any C in about 3 years
- I've _never_ written any C-extension-to-python type things
So I'd probably take ages to do it and still screw it up :-S

Anyone else want to give that a go?

cheers,

Chris