Re: [Zope] Odd behaviour while searching in the namepsace
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
Hi Tres,
Not conclusive. The browser might be perfectly happy to strip off the trailing space. Try <dtml-var expr="_.len(mwid)"> to see for sure.
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.
Forget my previous reply. <dtml-var expr="_.len(mwid)"> did work, there was another problem. Forgive me (a bit to quick on send mail button). You were right. It's an artifact besides DTML. The len function always returns 20 as the lenght of mwid. I seem's to be a problem of MS SQL-server 7 or the ODBC DA. Regardless what the lenght of the content in a Varchar field is, SQL-server 7/ODBC DA alway seems to fill out the field with blancs to the max field width. So the 'ugly' workaround by Martijn seems necessary. Thanks, Henny van der Linde Leiden University
participants (2)
-
Henny van der Linde -
Tres Seaver