[Zope] dtml methods and properties

Dieter Maurer dieter@handshake.de
Mon, 4 Dec 2000 21:16:39 +0100 (CET)


Willem Broekema writes:
 > As a DTML method is said to work with the properties of the object it
 > is called at:
 > 
 > DTML method "m":
 >  <dtml-var bobobase_modification_time>
 > 
 > <root folder of site>/m 
 >  displays the date/time when the last change happened to any file
 >  in the root folder
 > 
 > <root folder>/m/m
 >  displays last change date/time of method m
 > 
 > Why does the method not display it's modification time on the first
 > occasion? Or: why does it not give the folder's modification time
 > on the second occasion?
I suggest, you read the sections about the DTML namespace
in the upcoming Zope book (online on zope.org).

  You will learn that the namespace is a stack of bindings. When a name
  is looked up, the bindings on the stack are successively asked about
  the looked up name. The first binding that knows the name succeeds
  and returns the value.

At a different place in the book, you learn that

  a DTML method (in contrast to a DTML document) does not
  push itself onto the DTML namespace.
  Thus, you look through the DTML method onto the object,
  the method has been called for.
  You will not see the DTML method's own attributes or methods.


In your first example, "bobobase_modification_time"
is the attribute of the object, "m" has been called for:
this is "<root folder of site>".

In second first example, "bobobase_modification_time"
is the attribute of the object, "m" has been called for:
this is "m" in "<root folder of site>".
Thus, you see "m"'s "bobobase_modification_time".
It is however, the first, not the second "m".


Dieter