[ZPT] probleme with condition
Axel Müller
axel.mueller at amit-services.de
Wed Aug 25 05:26:17 EDT 2004
Am Mittwoch, 25. August 2004 10:56 schrieb gustav:
> Hello,
>
> I have a table with different columns (= numbers) coming from a mysql
> db.
> When the content of this columns meet a condition, I want to change the
> color.
>
> <td align="center"
> tal:content="python:container.s_division(var_period, info_count)"
> tal:condition="python:not container.s_compare(var_ouvre,
> container.s_division(var_period, info_count))"
> style="color=red"> </td>
> <td align="center"
> tal:content="python:container.s_division(var_period, info_count)"
> tal:condition="python:container.s_compare(var_ouvre,
> container.s_division(var_period, info_count))"
> style="color:green"> </td>
>
> the script s_compare :
> import string
> print int(round(10*(int(numint) - float(str)))) == 0
> return printed
>
> The problem : the test is not working, its allways green.
>
> But if I add a cell with the comparing thing as content
> <td tal:content="python:container.s_compare(var_ouvre,
> container.s_division(var_period, info_count))"> </td>
>
> I can see that the comparaison is ok - i get true or false
>
> What's wrong ?
is it ok, that printed returns a string, not a bool?
maybe you should return the bool:
the script s_compare :
import string
mybool = int(round(10*(int(numint) - float(str)))) == 0
return mybool
axel
--
axel.mueller at amit-services.de
http://www.amit-services.de
tel (06322) 680 668
fax (06322) 680 666
mobil 0160 973 483 27
More information about the ZPT
mailing list