[Zope] Acquisition: DTML Methods vs Documents

Oleg Broytmann Oleg Broytmann <phd@mail2.phd.pp.ru>
Fri, 5 Jan 2001 12:26:39 +0300 (MSK)


Hello!

   Can anyone here explain clearly what is the difference between DTML
Methods and DTML Documents regarding acquisition?

   Well, in simple cases I think I understand it. When I call a Method
through the web, it use dynamic (based on current URL) acquisition path. A
Document uses static (based on its position in ZODB) path.

   But what if I want to look a bit deeper? What are acquision paths for a
Method called from a Document, not directly from the web? I beleive when a
Document called from a Method it always uses static acquisition path. But
what about a Method called from a Document? It seems my Methods stopped
using dynamic paths and use static paths, provided by its callee. Right?

   Let's see a running demo. The site http://phd.russ.ru/pcgi/TEST/
constructed as follows:

/TEST - folder
   index_html - standard DTML Document with default content
   standard_html_header - DTML Method
   standard_html_footer - DTML Method
   2 - folder, empty

Both folders /TEST and /TEST/2 have a property "foobar". In /TEST its value
is "First test!", in /TEST/2 - "This is SECOND test." standard_html_header
show the property with <dtml-var foobar>.

   When I call standard_html_header directly through the web, it acquires
foobar using dynamic acquisition path:

http://phd.russ.ru/pcgi/TEST/standard_html_header
   show foobar from root (/TEST)
http://phd.russ.ru/pcgi/TEST/2/standard_html_header
   show foobar from /TEST/2

But then I call standard_html_header from DTML Document index_html:

http://phd.russ.ru/pcgi/TEST/index_html
   show foobar from root (/TEST); exactly as I expected, no problem
http://phd.russ.ru/pcgi/TEST/2/index_html
   WOW! It show foobar again from root, not from /TEST/2!
standard_html_header acquires using static path provided by index_html!

   Is it normal and intended behaviour? If it is, how can I "solve" my
problem? (I want to acquire different properties in standard_html_header,
but call standard_html_header from different DTML Documents).

Oleg.
----
     Oleg Broytmann     http://www.zope.org/Members/phd/     phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.