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

John Withers jwithers at nautilus.org
Thu Dec 4 15:31:44 EST 2003


Maik,

Thanks for your help. I had actually seen the section of the book you 
referenced and was trying to pass it as :
<dtml-var expr="mymethod(_)">

instead of passing it as
<dtml-var expr="mymethod(None, _)"> or
<dtrml-var expr="mymethod(callingDoc)">.

Thanks for your help in pointing me back to this section and understanding it.

jpw

Maik wrote:


>John Withers wrote:
> > Newbieish question.
>
>Please read the Zope-Book for self-answering newbiesih questions.
>
><http://zope.org/Documentation/Books/ZopeBook/2_6Edition>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>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