[Zope] Looping in DTML

Peter Bengtsson mail@peterbe.com
Mon, 24 Feb 2003 23:01:03 +0000


>
>
>The problem is that I need more than one column per line of data
>E.G.
>
><dtml-in (ordnumber,description)>
>   <dtm-var sequence-item>
></dtml-in>
>
>output
>
>01  Freight
>02  Delivery

The "ordnumber" sounds like something you could provide in the SQL; even 
though the data does not exist in the table.
If you don't like that approach, and if you need it as simple as your 
example, then just use string.zfill

 >>> import string
 >>> string.zfill(4, 2)
'04'
 >>> string.zfill(44, 2)
'44'

I.e. like this: <dtml-var "_.string.zfill(_['sequence-number'], 2)">



>Is there a way I can do that ?
>
>thanks,
>
>Flavio
>
>
>
>---
>
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.458 / Virus Database: 257 - Release Date: 2/24/2003
>
>
>_______________________________________________
>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 )