[Zope] Re: passing context using expr="dtml_method()"?

Maik Jablonski maik.jablonski at uni-bielefeld.de
Thu Dec 4 13:29:33 EST 2003


John Withers wrote:
> Newbieish question.

Please read the Zope-Book for self-answering newbiesih questions.

http://zope.org/Documentation/Books/ZopeBook/2_6Edition

> When I am calling a dtml method using a dtml tag such as <dtml-var
> mymethod> it appears to pass the namespace of the calling document.
> 
> However, when I am calling a dtml method using the expr syntax, such as 
> <dtml-var expr="mymethod()"> it doesn't. 

Taken from the Zope-Book:
http://zope.org/Documentation/Books/ZopeBook/2_6Edition/ScriptingZope.stx

"""Note that DTML Methods and Documents take optional client and REQUEST 
parameters. If a client is passed to a DTML Method, the method tries to 
resolve names by looking them up as attributes of the client object. By 
passing our context as a client, the method will look up names in that 
context. Also, we can pass it a REQUEST object and additional keyword 
arguments - the DTML Method will first try to resolve names in them."""

Use <dtml-var expr="mymethod(None, _)">

Cheers, Maik





More information about the Zope mailing list