[Zope] Passing mapping argument to DTML Method

Max M maxm@mxm.dk
Thu, 26 Sep 2002 16:39:45 +0200


Antonio Beamud Montero wrote:

 >  I'm a bit frustrated trying to pass dictionaries to DTML Methods, I
 > need to pass a dictionary with a lot of pairs key, value to be rendered
 > in a DTML Document.
 > I do something like:
 >
 >  monitor_html = DTMLFile('dtml/onemonitor',globals())
 >  ...
 >  return self.monitor_html(None,...)
 >
 > But how I can simply pass this dictionary to the namespace of this DTML
 > Document? Adding it to the request?

You can safely do it like:

return self.monitor_html(self, self.REQUEST, **yourdict)

dtml will take the values from yourdict before the values in request and 
self.

You can also do it like:

return self.monitor_html(None, {}, **yourdict)

But then you *only* pass the values from yourdict

perhaps it's even feasible to:

return self.monitor_html(**yourdict)

But that can be a bit fishy. Especially if your dict by chance has the 
keys "client" or "mapping"


regards Max M


---

The reason I don't reach any higher is that I stand on the shoulders of 
midgets.