RE: [Zope] Passing variables to a DTML method ...
At 17:41 23-9-99 , Michel Pelletier wrote:
-----Original Message----- From: Darran Edmundson [mailto:Darran.Edmundson@anu.edu.au] Sent: Thursday, September 23, 1999 11:03 AM To: zope@zope.org Subject: [Zope] Passing variables to a DTML method ...
Could someone explain how to pass variables to a DTML method? For example, if I have the following in a DTML method:
<dtml-call "REQUEST.set('testvar', 'value')"> <dtml-var "calledmethod(REQUEST)">
Due to some hysterical, I mean historical reasons you cannot simply "call" a DTML Method unless you pass in a few things.
A DTML object needs a context in which to render itself. This context can be passed in one of three ways, as a 'client' object, a 'REQUEST' mapping (any mapping) or as keyword arguments to the method. For example:
<dtml-var "calledmethod(_.None, _, testvar=value)">
is one way to do what your looking for. _.None is the client (None), _ is the current namespace stack (thus the method will render itself in the current context) and 'testvar=value' is a keyword argument for your variable.
In this case, because all variables arei in the REQUEST object, you can just do: <dtml-var calledmethod> -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | T: +31 35 7502100 F: +31 35 7502111 | mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ---------------------------------------------
participants (1)
-
Martijn Pieters