[Zope] DTML Confusion?

Oleg Broytmann Oleg Broytmann <phd@phd.pp.ru>
Fri, 31 Aug 2001 18:46:35 +0400 (MSD)


On Fri, 31 Aug 2001, John Ziniti wrote:
JZ>Am i just missing something simple here?  I want to keep certain
JZ>DTML Methods in a common folder so they can be used from anywhere.
JZ>
JZ>I have:
JZ>
JZ>TestFolder
JZ>    index_html
JZ>Util
JZ>    utility_function
JZ>
JZ>Now my confusion.  Within TestFolder.index_html, I'd like to be
JZ>able to:
JZ>
JZ><dtml-var "Util.utility_function">
JZ>
JZ>but this returns unrendered content of utility_function.  I can
JZ>
JZ><dtml-with Util><dtml-var utility_function></dtml-with>
JZ>
JZ>but I hate <dtml-with> ... and I can also
JZ>
JZ><dtml-var "Util.utility_function(REQUEST=REQUEST)">
JZ>
JZ>but that is also a little long-winded.
JZ>
JZ>Comments? Advice?  Thanks ...

   DTML objects are really callable instances of classess. dtml-with calls
them automagically, but when you use dtml-var "..." these quotes move you
from DTML to Python, and in Python there is no automagical call - you must
call the objects yourself. There is no way to avoid it.

Oleg.
----
     Oleg Broytmann     http://www.zope.org/Members/phd/     phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.