[Zope] Interesting name space question

Dieter Maurer dieter@handshake.de
Sat, 21 Dec 2002 14:59:27 +0100


Kevin Carlson wrote at 2002-12-20 16:34 -0500:
 > I am curious if the following is possible in dtml...
 > 
 > I have a dtml-method named index_html.  It calls a dtml-method named
 > page_header.  Is it possible for the code in page_header to obtain the title
 > of the index_html method?
 > 
 > For example:
 > 
 > index_html: (Title set to "Home")
 >    <dtml-var page_header>
 > 
 > page_header:
 >    <dtml-var Title of calling dtml method>
 > 
 > I have been searching through the archives and such but since dtml-methods
 > look up variables in the containing namespace, I'm not sure if this is a
 > possibility.
In general, this is impossible (because "page_header" does not know
which object called it (unless the "security context stack" is analysed)).

In the special case, when "index_html" is called directly through the
Web (via "ZPublisher"), "index_html" is available as "REQUEST.PUBLISHED".

However, a better idea is probably to set a "parent_title" variable
in the calling context and use it in the called DTML method, when it is
defined.


Dieter