[Zope] dtml-var in another directory without entity syntax

Dieter Maurer dieter at handshake.de
Fri Dec 12 13:02:27 EST 2003


Small Business Services wrote at 2003-12-11 14:46 -0500:
>Dieter's response...
>> Usually, this is not a good idea.
>>
>>   DTML Document is much more confusing than helping.
>>   I advice to use it only when one really knows why
>>   (and otherwise forget about it completely).
>>   I never used DTML Documents.
>
>I have been working with zope for about 4 years now and have used DTML
>Documents successfully on several occasions.  What don't you like about
>them?

That they result in very strange and unpredictable name lookup:

When you look at its "__call__" definition you see that
it uses "(self.aq_explicit, client)" as "client" for the DTML
template.
This often just means: look for your own attributes,
then look for that of "client" (and its acquistion context).
If however, the DTML Document has been accessed indirectly,
then lookup includes also part the the documents acquisition 
context. You find a problem report (from me) in the mailing list
archives.


The other objection: Search the mailing list archives for the numerous
problems where people use "objectValues()" (or friends) in
a DTML Document and are astonished that they see nothing.
I answered dozens of such messages (telling them to forget about
DTML Documents and always use DTML Methods).


There are rare circumstances where a DTML Document may make sense
(I did not meet one; but I can imagine cases). Thus, when you
are an expert and you know why you use a DTML Document, use
it. When you are a beginner, forget about them.

-- 
Dieter



More information about the Zope mailing list