[Zope] testing with dtml-if

Dustin Mitchell dustin at ywlcs.org
Thu Sep 4 22:15:35 EDT 2003


On Thu, Sep 04, 2003 at 08:08:39PM -0500, J Cameron Cooper wrote:
> >or possibly
> >
> > <dtml-if expr="`w` == 1"> ...
> > 
> >
> This is asking about the truth value of the Python expression " 'w'==1 
> ", which means "the character 'w' is equal to the integer 1." This will 
> never be true, since 'w' is not 1.

Your explaination was spot-on up until this one.  `w` (backticks) is
the string representation of the value of w.  'w' (single quotes) is
the character 'w'.  Perhaps your mailreader confuses the rendering of
such punctuation.

Anyway, the purpose of the above dtml-if tag is to more closely match
the effect one might expect of a (admittedly illegal) nested dtml-var,
as dtml-var stringifies its argument.  In the end, you're right,
though, because no string will ever equal 1.*

Dustin

* Unless you're in Perl-land or PHP-land.  If you are, I offer my
condolances and hope you are allowed to return soon. :-)

-- 

  Dustin Mitchell
  dustin at ywlcs.org/djmitche at alumni.uchicago.edu
  http://people.cs.uchicago.edu/~dustin/
  PGP Key: http://people.cs.uchicago.edu/~dustin/pubkey.txt



More information about the Zope mailing list