[Zope] String compare

Dieter Maurer dieter@handshake.de
Wed, 14 May 2003 20:47:24 +0200


Passin, Tom wrote at 2003-5-13 13:16 -0400:
 > [n.a.s ]
 > 
 > > I can't compare a String with a dtml-var variable.
 > 
 > > <dtml-if expr="REQUEST.has_key('nol') and nol=='<dtml-var id>'">
 > 
 > Of course you can do a compare, but not with invalid syntax.  The
 > <dtml...> tag just sets up the environment for accessing objects, and
 > there is no need to try to stick another <dtml> tag inside one (even if
 > it were allowed).
 > 
 > All you need is the obvious -
 > 
 > <dtml-if expr="REQUEST.has_key('nol') and nol==id">

Because "id" is sometimes a method and sometimes a string,
it is better to use:

   <dtml-if expr="REQUEST.has_key('nol') and nol==getId()">


Dieter