Zope/DTML Infuriating...
William Heymann
kosh at aesaeion.com
Tue Apr 29 11:37:28 EDT 2008
On Tuesday 29 April 2008, Jens wrote:
> Hello Everyone.
>
> <dtml-let prefix="'main'">
> <ul>
> <dtml-in expr="_.range(1,10)">
> <li><dtml-var expr="_['prefix'] + _['sequence-item']"></li>
> </dtml-in>
> </ul>
> </dtml-let>
>
I think you are going to really regret doing things this way, it is only going
to make your life much harder regardless of if you are using zpt or dtml by
doing stuff like this inside the template. The most correct way in zope to do
this is to use a python script object and have the dtml call that.
For example your python script would have
return ['main%s' % i for i in range(1,10)]
and your dtml would have
<ul>
<dtml-in path.to.you.script()>
<li><dtml-var sequence-item></li>
</ul>
This leads to much cleaner and easier to maintain systems.
More information about the Python-list
mailing list