If your result.sum_adt_out
attribute is a string, your test will fail.
Also note that <>
has been deprecated in Python, use !=
instead to test inequality. Your template, simplified and with calling float()
on the value first to ensure that it is numeric, then becomes:
<td style="text-align: right;" tal:define="sum_adt_out python:float(result.sum_adt_out)">
<span tal:condition="sum_adt_out"
tal:content="python:'%.1f' % (float(result.sum_cenmn)/sum_adt_out,)">currentindex</span>
<span tal:condition="not:sum_adt_out">0.0</span>
</td>