[Zope] why DTML confusing

Charlie Wilkinson cwilkins@boinklabs.com
Fri, 10 Nov 2000 15:11:22 -0500


First Simon, thanks for your message.  Yours is one of the most articulate
explanations I've seen on this topic.

Simon Michael simon@joyful.com writes:
> Irene Barg <ibarg@as.arizona.edu> writes:
>
[examples of DMTL confusion...]
> 
> It is confusing. There are two systems of syntax in use here - DTML's
> and python's. Once you start using "" expressions, you have left DTML
> and you are in the python world. 

...or "the python world with some Zope limitations placed on it."

There's a third world of course, HTML.  Most of us probably have that
down solid, so we tend not to think of it in the context of "skills
needed to master Zope."  But whether it's wrapping data in an HTML
table, or how to create dynamic CGI forms, mastering the integration of
HTML and DTML is a critical skill that some apparently find difficult.
(I've seen HOWTO's for it...)

> - unfortunate reality #1: you have to use "" expressions to do any
> kind of comparison, so you are pretty much forced into dealing with
> these two worlds right from the beginning.

That's fine, but in the interests of good will and sanity, Zope should
probably have a big fat warning label saying "DO NOT VENTURE HERE IF
YOU DO NOT ALREADY KNOW, OR PLAN TO LEARN PYTHON."

I did know Zope was written in Python.  I did not expect that I would have
to learn it.  Maybe that was stupid on my part, but that's what I thought.

> Still, entering the python world would normally be a good thing, since
> syntax there is simple and consistent. But,
> 
> - unfortunate reality #2: certain legacy zope variables contain "-" in
> their name. In the python world, this is illegal (or rather it means
> something different) and so you are forced to remember constructs like
> _['sequence-index'] all the time.
> 
> It might be that fixing one or both of the above would reduce the DTML
> pain factor quite a bit. Certainly, it's time to do whatever it takes
> to banish these "-"-named variables, IMHO.

Yes, it would help a lot.  _[] is about as non-intuitive as you can get,
especially after mixing in all the single and double quotes.  Sure, if
you understand python and how DTML wraps around it, it all makes sense,
but that's a pretty narrow market and DMTL simply doesn't need to be
that obfuscated.  If the intended market is simply "people who grok
Python", then there's really no point in something as Point n' Click n'
GUI as Zope is.

I certainly don't have all the answers, but it seems a simple matter to
allow both sequence-index *and* sequence_index - i.e., create underscore
equivalents alongside all the legacy "hyphen" variables.  If I recall,
I've even seen some user-contributed patches on this list to do just that.

That's just one example of something in Zope that's "too difficult"
screaming for change.  But one of the practical advantages of making
that kind of change is that the people who contribute their valuable
time to help the newbies (and not-so-newbies) on this list won't spend
quite so much time saying

	Try this:

	<dtml-in "AUTHENTICATED_USER.getRoles()">
	  <dtml-if "_['sequence-item'] == 'Admin'">
	    <dtml-call "REQUEST.set('edit_ok','y')">
	  </dtml-if>
	</dtml-in>

That's an awful lot of weird syntax glue just to walk a list and set a
value based on values in the list.  If someone asked how to do that on a
Perl mailing list, they'd be RTFM'ed and run out of town.  Maybe that's
not an entirely fair comparison, but still, how much of that syntax
nightmare might be avoidable?  I really don't know enough to say.
Obviously *everything* has to be wrapped in something that at least
distinguishes DTML from HTML.  How quickly or deeply (or just *how*)
one should get into python after that is another matter.

Zope reminds me of NT in some ways (except that I *like* Zope).
Zope, like NT, presents this illusion of friendly, easy learning curve,
straight-forward "get the job done and move on" philosophy.  At least that
was my first impression.  Then reality struck and I'm still recovering!
What keeps me working with Zope is not so much what Zope is, but the
promise of what it can be.  (And the hope that when I'm finally a Python
ace and understand the Zope source code from nose to tail, I'll be ready
to work in DTML ;-)

-cw-

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            Charlie Wilkinson - cwilkins@boinklabs.com - N3HAZ
Parental Unit, UNIX Admin, Homebrewer, Cat Lover, Spam Fighter, HAM, SWLer...
    Visit the Radio For Peace International Website: http://www.rfpi.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            CLOBBER INTERNET SPAM:  See!! <http://spam.abuse.net/>        
                                   Join!! <http://www.cauce.org/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
QOTD:
"Bush is a big corporation disguised as a human being running for president."
	-- Ralph Nader on David Letterman (9/28/00)