[Zope] How to Pass values to a DTML method ??
Tue, 12 Sep 2000 19:09:39 +0200 (CEST)
Stuart Foster writes:
> Dieter Maurer wrote:
> > You should include two positional parameters as well:
> > <dtml-var "some_method(_.None,_,param=value)">
> This is the way I had to do it what's up with the two extra params?
DTML objects use the DocumentTemplate's (--> DocumentTemplate.DT_String)
__call__ function for rendering.
This function has two (optional) positional arguments, "client" and
"mapping" and an arbibrary number of keyword parameters.
All these parameters together determine the content of
this magic "namespace" that is used for name resolution inside
If you want more details about this, look either at the source
code documentation or search the lists archive for another
post where I explained that in more detail.
For a DTML object "name",
<dtml-var name> is equivalent to <dtml-var "name(_.None,_)">,
i.e. the client is "None" and the mapping is the namespace
object "_". This propagates the namespace of the calling
object into the called DTML object.
If you use <dtml-var "name(kp1=v1, kp2=v2, ...)">, i.e.
you do not provide parameters for the positional parameters,
there use their default value, "None". This implies that
the outer namespace and the corresponding context is not
available in the called DocumentTemplate.