Mailing List Archive

Calling function with variable arguments from ZPublisher (was: Re: Using psycopg directly in Zope Python script)
Jørgen Frøjk Kjærsgaard wrote at 2005-7-4 11:04 +0200:
> ...
>Another question: When I define an external method to process form data,
>I have to do it like this:
>
>def process_form_data(self, name, address, zip, ...):
> ...
>
>What I would like to do is:
>
>def process_form_data(self, **args):
> ...
>
>so that I don't have to alter the argument list if I add or remove
>fields. However, args always comes out empty, presumeably because Zope
>inspects the argument list and passes only those arguments that have a
>matching name in the list.

Indeed.

>Is there any way to tell Zope to pass "the
>rest" in **args?

No (unless you change "ZPublisher.mapply.mapply").

But, you can access all your request arguments via "REQUEST" (which you
can either pass explicitly or access via "self.REQUEST").

--
Dieter
_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db