Re: ZSql and evaluating the results for a 0 or 1 - Newbie help

[email protected]
Newsgroups gmane.comp.web.zope.database
Message-ID <OF6CB2D313.1676E406-ON072571B2.007A548B-072571B2.007A6449@smsc.com>
I apologize that this is not really db related.  Thanks it worked 
perfectly!!

---

Steven M. Klass

Design Automation Manager

SMSC
3930 East Ray Road, Suite 200
Phoenix, Arizona 85044
(480) 704-7046 (Desk)
(480) 225-1112 (Mobile)
[email protected]



Maciej Wisniowski <[email protected]> 
Sent by: [email protected]
07/21/06 02:50 PM

To
Steven Klass/SMSC@SMSC
cc
[email protected]
Subject
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 
'red'"
            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
[email protected]
http://mail.zope.org/mailman/listinfo/zope-db

_______________________________________________
Zope-DB mailing list
[email protected]
http://mail.zope.org/mailman/listinfo/zope-db
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.