[Twisted-web] system.multicall support for the XML-RPC server

Dave Benjamin dave at ramenlabs.com
Tue May 5 19:31:13 EDT 2009


On Sat, 2 May 2009, twisted-web-request at twistedmatrix.com wrote:

> Hi Dave!  Thanks for taking the time to contribute.
>
> Unfortunately, this contribution will almost certainly be lost if you
> don't open a ticket for it at <http://twistedmatrix.com/trac/newticket>.
> Once you've done that, you'll need to mark it for review by adding the
> "review" keyword and reassigning it to nobody - the empty entry at the
> top of the "reassign" menu.

Thanks for your thoughtful comments! I created a ticket with a patch and 
unit test and tried to respond to all of the things you mentioned. The 
ticket is here:

http://twistedmatrix.com/trac/ticket/3823

>> I had to add to the XMLRPCIntrospection class in order to include my
>> method in the system namespace, even though it is not really an
>> introspection method. It's also possible to subclass
>> XMLRPCIntrospection
>> from outside of xmlrpc.py and use putSubHandler instead of
>> xmlrpc.addIntrospection to create the "system" namespace.
>
> I'm not quite sure what you're getting at here - do you think one of
> these other approaches would be better!

Well, I'm sort of thinking out loud here, because I'm not sure. As 
designed, the way to get a "system" namespace in your XML-RPC server is to 
call xmlrpc.addIntrospection(server). However, the "system.multicall" 
method belongs to the "system" namespace and is not an introspection 
method. If I were to add another method called xmlrpc.addMulticall(), the 
two methods would both be responsible for creating the system namespace. 
Would the multicall method go in its own class? Or would it be 
monkey-patched onto the XMLRPCIntrospection class? The latter would 
avoid breaking existing code, but it would also create an order of 
operations requirement (first introspection, then multicall), which would 
be inelegant.

For comparison, this is how SimpleXMLRPCServer does it:
http://docs.python.org/library/simplexmlrpcserver.html#SimpleXMLRPCServer.SimpleXMLRPCServer.register_introspection_functions

> ... join us in the #twisted IRC channel on chat.freenode.net.

I'll be around as "ramenboy" - maybe I'll see you around.

Thanks,
Dave

-- 
.. Dave Benjamin - Software Developer - Phoenix, Arizona
.. http://ramenlabs.com | http://twitter.com/ramenlabs



More information about the Twisted-web mailing list