[Zope] ZClass/DTML Document transparency

Dieter Maurer dieter@handshake.de
Tue, 21 Nov 2000 23:03:26 +0100 (CET)


Randall Kern writes:
 > ....
 > In the case of DTML Documents, the following works fine:
 > 
 > <dtml-var sequence-item>
 > 
 > In the case of ZClasses, I have to use something like this:
 > 
 > <dtml-with sequence-item>
 >   <dtml-var index_html>
 > </dtml-with>
 > ....
 > But this is rather ugly, and it's the sort of thing one shouldn't have =
 > to do in an oo system.
I understand you, but in all "oo" systems, you can avoid this
only if both objects have the same method.

In Zope, DTML objects have a "__call__" method which is
called automatically.
ZInstances do not have a "__call__" method.

What suggests to you, that these too should be unified
is the fact, that ZPublisher does it.
If an object has a "__call__", it is used; if not,
"index_html" is called, if it exists.

You may look at the mixin "ZCallable".
I do not know what it does but the name suggests, it might
perhaps help you.


Dieter