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

Ausum Studio ausum_studio@hotmail.com
Fri, 14 Feb 2003 07:37:39 -0500


----- Original Message -----
From: "Chris Withers" <chrisw@nipltd.com>
To: "Ausum Studio" <ausum_studio@hotmail.com>
Cc: <zope@zope.org>
Sent: Friday, February 14, 2003 5:56 AM
Subject: Re: Java re-invents DTML :-)


> 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 ;-)

I must agree to that. Let's all improve DTML and trash ZPT ! ;)
Talking seriously, after all this time of watching things going by, I've
come to think that by having both languages we have an advantage over the
competition. We'd need to reinforce that instead of *bashing* one of them.

> > 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!

In my opinion it depends on the size of the method and its purpose, as what
does matter  is how easy is to manage, read and reuse the code. At some
place there might be the equation evaluating the code management efficiency
(for a determined task), as a result of comparing the number of methods,
its size in characters, and the changeability of the content that could
possibly be inside them.  I have my own equation, and find that yes, there
are cases when a single method for a few tasks drives to an overall better
code management.

>
> > 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:

I knew you'd say that! :)

>
> <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? ;-)

Unfortunately neither the three of them work  :)  (in the context of my
needs, of course)
When you have the time, I'd appreciate that you take a look at CMFPortlet's
code, at the part I use to call portlet views. Lucky me that DTML did the
job. ;)


Ausum