[Zope] DTML Syntax contd. + rant

Martijn Faassen m.faassen@vet.uu.nl
Thu, 11 Nov 1999 15:34:30 +0100


Stuart 'Zen' Bishop wrote:
> 
> On Wed, 10 Nov 1999, Martijn Faassen wrote:
[snip my rant on DTML]
 
> I'm with you 100%. It makes me feel like I'm programming a reverse polish
> calculator sometimes :-)

It makes me feel like I'm programming in Perl sometimes, and I don't
want to know Perl. :) Perl's fine, great and dandy for other people I'm
sure, it's just that *my* poor brain can't understand it and doesn't
want to understand it.

> A low-level user (one not confidant in writing external methods) shouldn't
> have use magic constructs like <dtml-var "_['sequence-item'].title_or_id()">
> dtml-in is the main culprit - a synonyms for the magic variables that conform
> to python naming standards need to be created and the old ones depricated.
> Is there any reason why I should fix this and submit the patch for 2.1?
> (or 2.2?)

Is there any reason why not, you're asking? I don't see any reason why
not to change them, but there just has to be one, otherwise it'd been
done a long time ago, right?
 
> Possibly REQUEST needs to be available through aquisition rather
> than having to be passed to everything.

Hm, I don't know if this would clear up the picture, as opposed to
obfuscate things even more. It's true that even after a year I'm still
vague on how to express the equivalent of <dtml-var name=foo> in a
<dtml-var expr="what do I put here?">... I think I have accomplished it
a couple of times, but forgot again. There should be a HOWTO or
something..
 
> How about
> <dtml-python>

In general something like this would make you lose the split between
layout/templating issues (DTML) and more sophisticated programming
issues (Python). Zope's idea is to keep them separate. I'm inclined to
agree with this philosophy. Not that a system like this (PythonMethods
that can behave a lot like DTML) wouldn't be nice by itself. I haven't
kept track of PythonMethods recently so I don't know what it can do
already right now.

The problem is that DTML can become almost *more* difficult than the
equivalent Python right now. Perhaps this is unavoidable due to the
limited nature of DTML, but I think it can be improved in several areas
still.

>     print "<p>"
>     print html_quote('''The <dtml-ver2> tag is executed, the code

dtml-python tag, you mean?
[snip example of Python DTML]

> Is existing DTML good enough for 'simple' scripting? I think the current
> confusion threshold occurs when people start needing to pass parameters
> to methods (and the whole quoted and unquoted thing kicks in, and suddenly
> they have to understand about the _ namespace, and the magic variables to
> pass a DTML method to make it work).

I think this part of DTML could be cleaned up, or at least avoided in
ngDTML.

Regards,

Martijn