[Zope] is possible use request.set in a zpt?

Miguel Beltran R. yourpadre at gmail.com
Mon Aug 31 18:19:24 EDT 2009


2009/8/25 José Henrique <jhreis at gmail.com>

> 2009/6/26 Miguel Beltran R. <yourpadre at 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_item"><br>
>    <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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20090831/03189cb1/attachment.html 


More information about the Zope mailing list