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

Reply via email to