durusmail: quixote-users: XML-RPC handlers in Quixote
XML-RPC handlers in Quixote
2002-03-13
2002-03-13
2002-03-14
2002-03-14
2002-03-14
XML-RPC handlers in Quixote
Greg Ward
2002-03-13
On 13 March 2002, Andrew Kuchling said:
> I've been implementing XML-RPC handlers under Quixote, and have found
> myself writing stereotyped code.  The function I keep repeating looks
> like this:
>
> def rpc (request):
>     # Get contents of POST body
>     data = ...
>
>     # Parse arguments
>     params, method = xmlrpclib.loads(data)
>
>     try:
>         result = rpc_process(method, params)
>     except:
>         # report exception back to client
>         ...
>     else:
>         return xmlrpclib.dumps(result)

I'm not clear on what the custom code is here.  Is what the code in the
function whose name is stored in 'method'?

> So what would a natural Quixote-like interface for this would be?
> Here's a suggestion:

I have to believe there's a nice OO design waiting to jump out at you --
surely you can get away without having to grovel through some other
scope's locals() -- yecchh.

But I don't really understand the context, so it's hard to take a stab
at how to structure the classes and methods.

        Greg


reply