[Zope] namespace problem

hans hans@beehive.de
Tue, 12 Feb 2002 14:20:56 +0000


Ulrich Wisser wrote:

> Hi,
>
> How can I use named arguments and still have
> the namespace available for the method?
>
> Here follows what I do and why I have the problem:
>
> I have a dtml-method which is supposed to
> output a <select>...</select> form element. To
> do this it needs a loop over the results of an
> ZSQL method. The ZSQL method should only
> return rows with one special value. So it
> look like this
>
> ZSQL method "sites" (name is of course a defined
> argument) in folder "/sql"
> SELECT FROM SITES WHERE NAME=<dtml-sqlvar name type=string>
>
> DTML-Method "site" in folder "choose":
>    <dtml-in "sql.sites(name=sitename)">
>
> And I want to call the DTML-Method like this
> <dtml-var "choose.site(sitename=parsedname)">
>
> The problem is, if I call the dtml-method like this
> it won't work. I need to call it like
>    <dtml-var "choose.site(_.None,_)">
>
> But in that case I can not of named arguments like
> "sitename=parsedname" and I have to set "sitename" via
> the REQUEST object.
>
> I find this very unelegant. How can I use named arguments
> and still have the namespace available for the method?

http://www.zope.org/Members/michel/ZB/AppendixB.dtml
DTML Method:
__call__(client=None, REQUEST={}, **kw)

how about
   <dtml-var "choose.site(_.None, _, keywordparameter=value)">