[Zope] DTML namespace weirdness

John Chandler johnc@nipltd.com
Fri, 28 Apr 2000 10:17:41 +0100 (GMT)


> I've recently noticed some weirdness with namespace lookups in various
> dtml contexts. In particular, I've noticed the following problems:

Having spent way too much time yesterday on something like this, I wish
I'd heard this earlier! :-) Cheers for confirming my own sanity...

> Is anyone else able to confirm these results, and classify them as
> either expected, buggy, undocumentated or whatever kinds of behaviour?
> :)

Since we've revved to Zope 2.1.6 I've been having a huge problem with a
particular sql query. I've been stumped until your mail...

I have two variables set prior to the call, id and catID, and can confirm
these are the same before and after the call. For example id==12,
catID==18. I also have an SQL query which uses 'ID' as the single input
and returns several values including 'id' and 'name': (id will be the same
as catID). I know it's not wise to have id used more than once, but there
is a reason... honest ;-)

<dtml-in expr="zsqlSelectMethod(ID=CatID)">
 id: <dtml-var id>  name: <dtml-var name>
 ...
</dtml-in>

For catID==18, the following is printed:

 id: 12  name: Organisations

Using the zsql method's Test facility, ID=18 will give:

 id: 18  name: Web Sites

Interestingly, setting the dtml-in call to:

<dtml-in expr="zsqlSelectMethod(ID=1)">

yields:

 id: 12  name: Organisations

Setting ID to any value always yields whatever was in 'id' prior to the
zsql method being called... hmm, now that I think about it, I wonder if
it might be down to case insensitivty or something...

Yep, just tried it. By setting the zsql method parameter to 'IDX' rather
than 'id' I get the correct result for catID==18:

 id: 18  name: Web Sites

I'm positive that case insensitivity wasn't present before we switched to
2.1.6 as I've done work like this before without any clash. It's
particularly worrying that it grabs 'id' for the parameter ID in
preference to the explicitly requested ID=catID.


John

--
 John Chandler  /  Software Developer  /  New Information Paradigms Ltd
   [ Linux in the office, AmigaOS in the home, PalmOS in the pocket ]
------------------------------------------------------------------------
 The opinions above aren't those of my company...
                           ...but then, they aren't really mine either.