Espen Sorbye Frederiksen writes:
 > How do you pass on variables to a DTML Method.
 > If I would use a python method I would use <dtml-call "pythonmethod(var1,
 > var2)">. This does not work with DTML Methods. First of all why? Secondly
 > how is it possible to get around the problem?
DTML Methods have 2 positional and arbitrary many keyword parameters.
The positional arguments are "client" and "REQUEST".
"client" is an object (or tuple of objects or None).
All attributes of "client" are put into the DTML namespace.
"REQUEST" is a mapping object (or None), all keys of this
object are put into the DTML namespace.
All keyword arguments are put into the DTML namespace.

Thus, you can use:

      <dtml-XXX "method(_.None,_,param1=value1, param2=value2, ...)">

In this use: "_.None" is the client and "_" the mapping object.
You must pass the "_" as otherwise, you break the DTML namespace

An alternative, probably easier:

     <dtml-let param1="value1"
       <dtml-XXX method>

i.e. you bring the arguments into the DTML namespace (with the "let")
and then let DTML automatically pass the namespace to your method.


Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to