Petr Jakeš schrieb:
> Till now I hawe following which does not work. I mean the python "if" 
> statement works, but the rest (changing of the align value) does not.
> Any ideas?

 From your code I assume your table data looks something like that:

myTable = ((str, float), [('foo', 1.5), ('bar', 4242.42)])

You can then do the following (assuming Py 2.5):

<tr py:for="row in myTable[1]">
<td py:for="d, t in zip(row, myTable[0])"
     py:content="locale.format('%d', d, True) if t is float else d"
     align="${'right' if t is float else 'left'}"/>
</tr>

To make it clearer and more scalable, you can also define functions 
format_data(data, data_type) and alignment(data_type) and use these:

<tr py:for="row in myTable[1]">
<td py:for="data, data_type in zip(row, myTable[0])"
     py:content="format_data(data, data_type)"
     align="${alignment(type)}"/>
</tr>

Hope that helps.

-- Christoph

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
kid-template-discuss mailing list
kid-template-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kid-template-discuss

Reply via email to