[Zope] why DTML confusing

Simon Michael simon@joyful.com
10 Nov 2000 09:13:59 -0800


Irene Barg <ibarg@as.arizona.edu> writes:
> 1.  You can print the values of sequence-items with:
> 
>     (index=<dtml-var sequence-index>,
>      number=<dtml-var sequence-number>,
>      item=<dtml-var sequence-item>)
> 
> 2.  To test for equality, this does not:
> 
>     <dtml-if "sequence-index == 0">
>        (<dtml-var count-adassnum> Records found)
>     </dtml-if>
> 
> 3.  While this does work:
>     <dtml-if "_['sequence-index'] == 0">
>        (<dtml-var count-adassnum> Records found)
>     </dtml-if>

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. 

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

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.

Regards,
-Simon