[Zope] How do you increment a variable?

Tony McDonald tony.mcdonald@ncl.ac.uk
Thu, 29 Jul 1999 15:39:54 +0100


Cheers for the reply Michel,

>
>You can't do assignments inside Python expressions.

ahhhh...

>Of the top of my head, you might try:
>
><dtml-with "_(counter=1)"-->

typo, --> should be >

>  <dtml-var counter>
>  <dtml-let counter="counter+1">
>    <dtml-var counter>
>  </dtml-let>
></dtml-with>
>
>-Michel

This does work, I then tried to extend it with
<dtml-with "_(counter=1)">
   <dtml-var counter>
   <dtml-in "_.range(0,10)">
   <dtml-let counter="counter+1">
     <dtml-var counter>
  </dtml-let>
</dtml-in>
</dtml-with>

and got 1 2 2 2 2 2 2 2 2 2 2.
Is that because the <dtml-in> tag sets up another name space?
------
Dr Tony McDonald,  FMCC, Networked Learning Environments Project 
http://nle.ncl.ac.uk/
The Medical School, Newcastle University Tel: +44 191 222 5888
Fingerprint: 3450 876D FA41 B926 D3DD  F8C3 F2D0 C3B9 8B38 18A2