2011/1/25 Giuseppe Arvati <[email protected]>
> sto provando le modifiche suggerite ma mi da ancora errore
>
> <span tal:define="global totale python:0"/>
>
> <table class="grid listing">
> <tr>
> <th>Media</th>
> </tr>
> <tr tal:repeat="my_row here/getSMT_py">
> <td><span tal:content="my_row/MEDIA">-0:30</span></td>
> <span tal:define="totale python:(totale + my_row.MEDIA)"/>
> </tr>
>
> <span tal:content="totale">000</span>
> </table>
>
> errore
>
> * Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__
> __traceback_info__: (totale + my_row.MEDIA)
> * Module PythonExpr, line 1, in <expression>
>
> AttributeError: 'dict' object has no attribute 'MEDIA'
Mentre con TAL ("my_row/MEDIA" è un'espressione TAL) non devi preoccuparti
se l'elemento a cui vuoi accedere è un attributo di my_row (my_row.MEDIA) o
un elemento del dizionario my_row (my_row['MEDIA']) quando usi espressioni
python (come "totale python:(totale + my_row.MEDIA)") occorre fare la
distinzione (e quindi scrivere "totale python:(totale + my_row['MEDIA'])".
Silvio
_______________________________________________
Plone-IT mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/plone-it
http://www.nabble.com/Plone---Italy-f21728.html