[Zope] <dtml-var foo> vs. <dtml-var expr="foo()">

Juho Vuori juho.vuori at kepa.fi
Tue Jan 20 09:26:02 EST 2004


A newbieish question. I thought <dtml-var foo> and <dtml-var 
expr="foo()"> were the same thing. Seems they are not: Depending on the 
way foo is called something differs in the environment they run in.

Given the following situation:

I have an dtml-method foo =
  <dtml-var bar>

And dtml-method bar
  <dtml-var baz>

Plus a third method baz
  <p>Pazaa!</p>

Now viewing foo does exactly what you think it does: It goes calls bar 
which calls baz which returns the text <p>Pazaa!</p>

Now change the first method foo:
  <dtml-var expr="bar()">

And you'll get KeyError: baz

Does somebody understand what is going on?

My real-world situation is that I need to specify a path, which as far 
as I know forces me to use the expr="Pat.to.my.bar()" alternative. Or 
does it not?

Juho Vuori




More information about the Zope mailing list