[Zope-dev] calling dtml method with same name up the hierarchy.
Dieter Maurer
dieter@handshake.de
Tue, 7 Nov 2000 19:35:44 +0100 (CET)
Casey Duncan writes:
> The following should work in your nested standard_html_footer to call the
> higher level one without infinite recursion:
>
> <dtml-with "PARENTS[1]">
> <dtml-var standard_html_footer>
> </dtml-with>
I fear this solution is very unstable.
"PARENTS" is defined by the URL path (loosely spoken).
This means, what "PARENTS[1]" is depend on the number of path
components in the URL. If there are sufficiently many components,
you will get the infinite loop again.
I think, there is no reliable way when "standard_html_footer"
is a DTML method, as such an object has no way to access itself.
With an DTML document, you may have a chance (I did not check):
you would need an external (maybe Python) method
def container(o):
'''returns 'o's container.'''
return o.aq_inner.aq_parent
You could then try:
<dtml-with "container(this())">
<dtml-var standard_html_footer>
</dtml-with>
Dieter