[Zope] ZPT/DTML namespace problem

Danny W. Adair danny@adair.net
Wed, 02 Apr 2003 11:56:45 +1200


Hi,

I have a ZClass instance "Log" with a DTML (!) method "show_entries" in its 
class.
"Log" lies in
----------------------------------------------------------------------------------------------------
/path/to/Log
----------------------------------------------------------------------------------------------------

I also have a folder with an interface in it, one of its pages is
----------------------------------------------------------------------------------------------------
/interface/showLog
----------------------------------------------------------------------------------------------------

Now, if "showLog" was a DTML method, I could fill it with
----------------------------------------------------------------------------------------------------
<dtml-with "path.to.Log"><dtml-var show_entries></dtml-with>
----------------------------------------------------------------------------------------------------

But (of course :-)) I want "showLog" to be a ZPT.
Now my problem:
----------------------------------------------------------------------------------------------------
<span tal:define="Log root/path/to/Log" tal:replace="Log/show_entries">The 
log entries of Log</span>
----------------------------------------------------------------------------------------------------
won't work as (I) expected. Apparently - although I say "Log/show_entries", 
the ZPT passes "here" as the client to "show_entries". Of course that 
doesn't make sense: there are no log entries in "/interface/showLog". Why 
is "here" passed although I explicitly say "Log/show_entries"?

How can I solve this problem???

I tried
----------------------------------------------------------------------------------------------------
tal:replace="python:Log.show_entries(Log, request)"
----------------------------------------------------------------------------------------------------
but this looks somewhat stupid. Do I really have to explicitly pass a 
client and namespace to a DTML method, isn't there something like 
<dtml-with>? Anyway, it looks like the same problem would arise if 
"show_entries" was a ZPT itself. Right?

Thank you very much in advance,
Danny

P.S.: Please include my address explicitly in your reply ("Reply All"), 
since I am currently not subscribed to zope@zope.org. Thank you.