[Zope-dev] Missunderstanding of DTML Methods and acquisition?

R. David Murray R. David Murray" <bitz@bitdance.com
Sat, 11 Mar 2000 13:01:09 -0500 (EST)


On Sat, 11 Mar 2000, Walter Brunner wrote:
> If I call the following line from /user/regions/index_html:
>    <dtml-var "IManager()">
> and IMangaer has the folling line:
>     <dtml-var "img.objectIds(['Image'])">
> there is this error message:
>     Error Type: NameError
>     Error Value: img

I'm finding this to be one of the trickiest "simple bits" of dtml to
learn, even after having read the docs.  The following should work
in your /user/regions/index_html (tested):

<dtml-var IManager>

As you may already know, the following will instead get you quoted
text of the IManage method:

<dtml-var "IManager">

The following will also work (tested):

<dtml-var "IManager(_.None,_)">

This passes a 'client' of None and the namespace (that img exists
in) to the method.  (I presume that in the first working example above
Zope supplies the client and namespace to the method when it evaluates
it).  This call form is of course what you'll need if you want to
pass arguments to the method:

<dtml-var "IManager(_.None,_,somearg='someval')">

What I'm most confused about right now is when it is necessary to pass
the client and namespace and when you can omit it.  I'm also very unclear
as to just what the 'client' is, especially since most of the examples
I've seen involve passing in None for the client.

--RDM