[Zope] basic python -> dtml translation.

Evan Simpson evan@4-am.com
Sun, 12 Sep 1999 15:57:21 -0500


chas wrote:

> trivial no doubt, but buggered if i can find the python
> equivalent for "eval". eg. how would you rewrite this in
> dtml :
>
> for i in range(1,6) :
>         print (eval('var%s' % i))
>
>

<dtml-in "_.range(1,6)">
  <dtml-var "_['var'+_['sequence-item']]">
</dtml-in>

or, since you're a PythonMethods fan,

for i in range(1,6):
  print _['var%s' % i]

Thanks for the kudos, by the way.  As for the use of tabs in
PythonMethod code, my advice is: DON'T.  Hit the spacebar 2 or 4 times
instead; you'll be glad you did.  FTP only works for FTP-enabled
classes, which AFAIK only includes DTML objects.  Patches are welcome,
of course <wink>.