Re: [Zope] is possible use request.set in a zpt?
2009/8/25 José Henrique jhr...@gmail.com 2009/6/26 Miguel Beltran R. yourpa...@gmail.com: Hi list I used before with dtml something like this dtml-call request.set('sumVar',0) dtml-in ... dtml-call request.set('sumVar', sumVar + queryVar) /dtml-in The sum is dtml-var sumVar This is possible to made with ZPT? -- What about this way: dtml-in expr=(1,2,3) prefix=rows dtml-var expr=rows_itembr dtml-if expr=rows_end Total: dtml-var expr=rows_total_item /dtml-if /dtml-in José Henrique How say Andreas and Tres, I made a script [suma_py] parameters: rec, campo code: suma=0 for r in rec: suma+=r[campo] return suma [index_html] div tal:define=items aquery() div tal:repeat=item items ... /div div el importe es span tal:content=suma_py(items, 'importe') la cantidad es span tal:content=suma_py(items, 'cantidad') /div /div -- Lo bueno de vivir un dia mas es saber que nos queda un dia menos de vida ___ Zope maillist - Zope@zope.org https://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] is possible use request.set in a zpt?
It is possible... div tal:define=ignored python:request.set('sumVar', 0) but not recommended. The kind of logic you are trying to wedge into the template should be pushed out into a Python script, leaving the template only with the job of rendering the results. Tres. - -- I want show tabular data with money and the last show the sum can you explain me how can made better this then? almost never use python script :P Thanks ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] is possible use request.set in a zpt?
On 27.06.09 17:15, Miguel Beltran R. wrote: It is possible... div tal:define=ignored python:request.set('sumVar', 0) but not recommended. The kind of logic you are trying to wedge into the template should be pushed out into a Python script, leaving the template only with the job of rendering the results. Tres. - -- I want show tabular data with money and the last show the sum can you explain me how can made better this then? almost never use python script :P Huh? Write a PythonScript (yes, you should know some basic Python) returning the data as dict or list or something similar...then render the result as needed using ZPT. Should be documented in The Zope Book (docs.zope.org). -aj begin:vcard fn:Andreas Jung n:Jung;Andreas org:ZOPYX Ltd. Co. KG adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany email;internet:i...@zopyx.com title:CEO tel;work:+49-7071-793376 tel;fax:+49-7071-7936840 tel;home:+49-7071-793257 x-mozilla-html:FALSE url:www.zopyx.com version:2.1 end:vcard ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] is possible use request.set in a zpt?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Miguel Beltran R. wrote: Hi list I used before with dtml something like this dtml-call request.set('sumVar',0) dtml-in ... dtml-call request.set('sumVar', sumVar + queryVar) /dtml-in The sum is dtml-var sumVar This is possible to made with ZPT? It is possible... div tal:define=ignored python:request.set('sumVar', 0) but not recommended. The kind of logic you are trying to wedge into the template should be pushed out into a Python script, leaving the template only with the job of rendering the results. Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFKRYVA+gerLs4ltQ4RAoaPAKCs6/ILvD+1i5kA5UtVvqJwWpk+xwCg2u++ 5aEKQ0j4qUQdx23uC5gsD94= =zdwr -END PGP SIGNATURE- ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )