Zope style (was: tuning our site (was: help! advocacy resources needed fast))

Dylan Reinhardt python at dylanreinhardt.com
Thu Apr 3 00:39:25 CEST 2003

On Wed, 2003-04-02 at 12:54, Cameron Laird wrote: 
> I find
> it really interesting when one technology is unequivocally su-
> perior to another.  I think we have that with DTML vs. Python
> scripts.

[ jumping in mid-stream ] 

DTML and Python Scripts are different tools, each best-suited to a
particular thing.  Determining which is better obscures a more important
point: they're each good tools for a particular set of problems.

DTML's problem space is quite a bit smaller, but that doesn't make it a
bad tool... just one that should be applied more selectively than it
typically is. :-)

> There are a couple of pertinent facts.  First, much of the
> passion "Web designers" are supposed to have for "templates"
> comes from the supposition that they want stuff to look like 
> HTML, so they can use their "HTML editors".  Is *anyone* doing
> that with Zope, though?  

It's not really about the visual editors.  DTML is largely incompatible
with HTML editors... or so I hear. :-)

The purpose is more basic than that: one is a presentation tool, one is
a logic tool.

Templating is appropriate when 80-90% of what you want to do is simply
write out text.  With templating, there is no need to *say* that text
should be written out... everything you type is returned unless you
specify otherwise.

When you're performing logic, the reverse is true... most of what you
type *produces* your content and nothing is returned aside from that
which is *explicitly* returned.

Templating provides the least cluttered, most concise way of expressing
*integrating* static and dynamic content.  Python represents the most
concise way of expressing logical operations.  Each problem will consist
of some part logic and some part presentation.  Most of my Zope projects
use a blend of templating and scripting.

> Finally, while your dtml-let is an effective style, 

I almost never use dtml-let.  In my book, it's one of the first signs
that you're trying to do something DTML isn't well-suited for.  Another
is use of nested dtml-ifs more than a couple layers deep.

> projects always, always, 
> always seem to need more parametrization; managers say, "I want
> it just like that, except it needs to {apply to a different
> continent,show the current contents of the order,show the 
> expanded display when the user has selected that, ...}."

If that requirement is thought of as parameterization, DTML is a less
worthy tool than Python scripts, no doubt.  But if that same set of
requirements is thought of as "skinning" DTML is a great tool.

DTML's usefulness depends, to some degree, on your use of Acquisition. 
Your overall site design strategy might have a lot to do with why one
seems more powerful than the other for any given task.


More information about the Python-list mailing list