[Zope] Odd behaviour while searching in the namepsace

Tres Seaver tseaver@palladion.com
Sat, 12 Feb 2000 16:02:18 -0600


Evan Simpson <evan@digicool.com> wrote:
 
> ----- Original Message -----
> From: H.G.J. van der Linde <linde@fsw.leidenuniv.nl>
> > I found out that  using mwid with
> >
> >     <dtml-if "_.has_key(mwid)">
> >            <dtml-var "_[mwid].tag()">
> >
> >
> > one space is added to mwid, so I get 'linde '. This space is not in the
> > database, or generated by the database, I guess, because this works fine:
> >
> > <img src="/psychologie/mwfoto/<dtml-var mwid>" align="right">
> 
> Not conclusive.  The browser might be perfectly happy to strip off the
> trailing space.  Try <dtml-var expr="_.len(mwid)"> to see for sure.
> 
> > How do I use the (r)strip function in an expression like <dtml-if
> > "_.has_key(mwid)">.
> 
> You can <dtml-if expr="_.has_key(string.strip(mwid))"> and <dtml-var
> expr="_[string.strip(mwid)].tag()">

and Martijn Pieters <mj@digicool.com> corrected it to:

> Make that
> 
>   <dtml-if expr="_.has_key(_.string.strip(mwid))">
> 
> and
> 
>   <dtml-var expr="_[_.string.strip(mwid)].tag()">

I tried really hard to reproducte the problem, thinking that perhaps Zope was
mangling the extra space onto mwid's value when used inside the expr=""
attribute, while not in the name= one.  I think I have to conclude that Heer
Linde's problem is an artifact of something besides the DTML machinery, as no
combination of properties and subobjects seems to yield the same result.

So much for my rant on Zope's inscrutability in mangling a poor, helpless
property value, and requiring such an ugly workaround.

Tres.
-- 
=========================================================
Tres Seaver         tseaver@palladion.com    713-523-6582
Palladion Software  http://www.palladion.com