[Zope] Python 101 was: simple question about <!--#if expr="fieldname = 't'"-->
Tim Cook
tim@freepm.org
Wed, 21 Feb 2001 08:18:10 -0600
Donald Braman wrote:
>
> It worked brilliantly untill I changed my data type from text to bool. Now
> it evaluates, but never as true.
>
> My expression is: <dtml-if expr="bool_column == 't'">It is true</dtml-if>
> I've also tried expr="bool_column is true", "bool_column = 't'",
> "bool_column == 'true'", etc.
>
> I've found the Python documentation on basic types and their operations, but
> still can't figure out what I'm doing wrong.
Boolean expressions that evaluate as false are: 0 (zero), None
and empty strings, lists, tuples and dictionaries. So your
string is always true. "bool_column == ''" or "bool_column == 0 "
will eval false.
--
Tim Cook, President - FreePM,Inc.
http://www.FreePM.com Office: (901) 884-4126
New MedicationManager, Try it now at:
http://www.freepm.org:8080/FreePM