[Zope] Interesting name space question

Kevin Carlson khcarlso@bellsouth.net
Sat, 21 Dec 2002 11:04:53 -0500


Thanks, Dieter.  I was under the impression this was near impossible because
of the nature of dtml methods.  I know this can be done with dtml documents
which call a dtml method, but was curious about this because one of my older
(whilst beginning to climb the learning curve) applications needs some work
and being able to hack this would have helped.

Kevin

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
Dieter Maurer
Sent: Saturday, December 21, 2002 8:59 AM
To: Kevin Carlson
Cc: zope@zope.org
Subject: Re: [Zope] Interesting name space question


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

_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )