[Zope-DB] ZSql and evaluating the results for a 0 or 1 - Newbie help

Steven.Klass at smsc.com Steven.Klass at smsc.com
Fri Jul 21 18:16:52 EDT 2006

I apologize that this is not really db related.  Thanks it worked 


Steven M. Klass

Design Automation Manager

3930 East Ray Road, Suite 200
Phoenix, Arizona 85044
(480) 704-7046 (Desk)
(480) 225-1112 (Mobile)
steven.klass at smsc.com

Maciej Wisniowski <maciej.wisniowski at coig.katowice.pl> 
Sent by: zope-db-bounces at zope.org
07/21/06 02:50 PM

Steven Klass/SMSC at SMSC
zope-db at zope.org
Re: [Zope-DB] ZSql and evaluating the results for a 0 or 1 - Newbie help

Is this really DB related? ;)

> If item/results is == 0 I want to display "Pass" in green.
> If item/results is == 1 I want to display "Fail" in red. 

But you already have such clauses in your code. Try:

<span tal:condition="python: item['results']==0" class="green">Pass</span>
<span tal:condition="python: item['results']==1" class="red">Fail</span>

or if you have only two values (0 and 1):

<span tal:attributes="class python: item['results']==0 and 'green' or 
            tal:content="python: item['results']==0 and 'Pass' or 
'Fail'">Fail or Pass</span>

or... few other possibilities exists too.

I'm not sure whether 'item' is a dictionary so above code may fail on it.

Maciej Wisniowski
Zope-DB mailing list
Zope-DB at zope.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope-db/attachments/20060721/9d535882/attachment.htm

More information about the Zope-DB mailing list