[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Dynamic Content with DTML
Sat, 21 Sep 2002 19:36:54 -0400
A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/DTML.stx#2-33
Let's follow this DTML code step by step to see where the variables are
found. First Zope looks for *standard_html_header* in the current
object, which is the *pricelist* DTML Method. Next, Zope looks for the
header in the current object's containers. The *Feedbags* folder
doesn't have any methods or properties or sub-objects by that name
either. Next Zope examines the *Feedbags* folder's container, and so on
until it gets to the root folder. The root folder does have a
sub-object named *standard_html_header*. The header object is a DTML
Method. So Zope calls the header method and inserts the results.
% Anonymous User - June 6, 2002 9:27 am:
"Feedbags folder's container"... ok NOW I'm lost. A folder is NOT a container? or do you mean the parent
folder of the Feedbag folder?
% Anonymous User - June 6, 2002 9:33 am:
a folder == a container. Note in the above description that "Feedbags" is a folder. It means the folder that
contains the feedbag folder.
% Anonymous User - June 6, 2002 3:35 pm:
"container" = "parent" ?
% mcdonc - June 6, 2002 9:00 pm:
Yes, in this particular case.
% Anonymous User - June 10, 2002 9:40 am:
so there are other meanings for "Container"?
If so, please give reference where I might find more extensive definitions.
% mcdonc - June 10, 2002 9:47 am:
The word is not really a precise computer science term, it just means something that contains something else.
% Anonymous User - Sep. 12, 2002 5:17 pm:
in zope, i guess it is.
from a python script you can call something like
to afford a reference to the folder the script is
located in. doesn't seem to work in dtml-expr's,
% Anonymous User - Sep. 21, 2002 7:36 pm:
<dtml-var standard_html_header> really is
and the object named "standard_html_header" is a DTML Method, hence callable
(its (python!) class has a __call__-method).
DTML therefore *calls* standard_html_header and replaces the complete dtml-var tag with whatever this call
This automagically calling of callables makes DTML work miracles for experts and stuns laypersons!