[Zope] Re: Calling Method

Hung Jung Lu hungjunglu@hotmail.com
Sat, 18 Dec 1999 01:37:41 PST


Joshua Brauer wrote:
>
>Is there a simple way to see the name of the calling dtm-method.
>
>For example I want to have standard_html_header print the title of the 
>page, unless it's the index_html method.... Can I do something like a 
>dtml-if on a calling document?

There is a way to obtain the name of the calling document.

<dtml-if "_.string.split(URL0,'/')[-1] == 'index_html'">
...
</dtml-if>

But in general, I don't think you can access the caller
of a method, or the calling stack. For general DTML
methods, you may want to pass the "this()" object, or
the "_['id']" string when calling a method that needs
to know its caller.

Coming back to the basics, if you need a different
header functionality for index_html, I guess it's
better just to create a dedicated header, something
like an index_html_header, somewhere in the root
folder of your interest. This is almost surely a
better solution than using <dtml-if ...> statements
inside the standard_html_header method.

regards,

Hung Jung

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com