[Zope] Re: python-script to python-script XMLRPC
Dennis Allison
allison at sumeru.stanford.EDU
Sat Jan 10 16:59:54 EST 2004
On Sat, 10 Jan 2004, Dieter Maurer wrote:
> Hartmut Goebel wrote at 2004-1-10 10:33 +0100:
> >> getattr( server, 'foo')( [params] )
> >
> >Is this the statement you actually use? If so: you are passing a single
> >argument, which is a list with a single element. This is not what you want.
> >
> >Use
> > getattr( server, 'foo')( **params )
> >
> >which will pass teh elements of the dict as keyword parameters.
>
> Note that XML-RPC does not support keyword arguments.
>
In what I am writing below, server is an XMLRPC server proxy with
basic authentication transport.
So, what is the right call? Suppose I have a Python Script at
the remote sitei with an argument signature:
def foo( a, b, c ): ...
which I want to invoke via XMLRPC. How do I pass the positional
arguments?
If I have a DTML method foo, with keyword (that is cgi)
parameters a, b, and c, I know I can invoke it remotely by
writing in the invoking python script
pdict = {'a':1,'b':2,'c'3}
getattr( server, 'foo')([pdict])
That is, by passing the the params dictionary.
Is the proper server call for a python script
ptuple = (1, 2, 3,)
getattr( server, 'foo')( [ptuple] )
More information about the Zope
mailing list