[Zope] Re: Java re-invents DTML :-)

Chris Withers chrisw@nipltd.com
Fri, 14 Feb 2003 10:56:04 +0000


Ausum Studio wrote:
> Why the need to dispute? !

People suggesting DTML still has a place in Zope.
You shouldn't need to learn two templating languages and a scripting language 
just to use one web framework ;-)

> Page templates aren't meant to support logic, right? 

No, and neither is DTML. But DTML makes it easier for you to think you can put 
application logic into it without being horribly burned later.

> So, there you have
> something that page templates couldn't do: when you do need logic and
> content in a single method.

You should _never_ _ever_ have content and logic in a single method!

> Furthermore, I'd appreciate that you help me on this: How would you perform
> the following using ZPT or PythonScript?
> 
>    <dtml-in objectItems>
>    <dtml-var sequence-item>
>    </dtml-in>

Jeez, this is documented and painfully simple:

<tal:i repeat="item here/objectItems">
<tal:x replace="item"/>
</tal:i>

Of course, you probably want to display that, so something like the following is 
more likely:

<table>
<tr tal:repeat="item here/objectItems">
<td tal:content="item">Sample content</td>
</tr>
</table>

In a python script, it'd be:

for item in context.objectItems():
    print item() # this line might need ot be edited
                 # depending on what the items are
return printed

Now, any other excuses why you think DTML should still exist? ;-)

cheers,

Chris