Missunderstanding of DTML Methods and acquisition?
I have the following problem: There is a folder /img (containing Images). There should be a DTML-Method IManager (for managing the Images) in the folder /. There is a DTML-Document index_html somewhere in the hierachy (let's say /user/regions) If I call the following line from /user/regions/index_html: <dtml-var "img.objectIds(['Image'])"> everything is OK. (I get a list of all images) 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 Why can't I call img.objectIds(...) from the DTML-Method? I also tried putting IManager to the img-folder, but the result was the same. Please help! Walter
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
participants (2)
-
R. David Murray -
Walter Brunner