Package cherrypy :: Module _cptools :: Class XMLRPCController
[hide private]
[frames] | no frames]

Class XMLRPCController

source code

object --+
         |
        XMLRPCController

A Controller (page handler collection) for XML-RPC.

To use it, have your controllers subclass this base class (it will turn on the tool for you).

You can also supply the following optional config entries:

   tools.xmlrpc.encoding: 'utf-8'
   tools.xmlrpc.allow_none: 0

XML-RPC is a rather discontinuous layer over HTTP; dispatching to the appropriate handler must first be performed according to the URL, and then a second dispatch step must take place according to the RPC method specified in the request body. It also allows a superfluous "/RPC2" prefix in the URL, supplies its own handler args in the body, and requires a 200 OK "Fault" response instead of 404 when the desired method is not found.

Therefore, XML-RPC cannot be implemented for CherryPy via a Tool alone. This Controller acts as the dispatch target for the first half (based on the URL); it then reads the RPC method from the request body and does its own second dispatch step based on that method. It also reads body params, and returns a Fault on error.

The XMLRPCDispatcher strips any /RPC2 prefix; if you aren't using /RPC2 in your URL's, you can safely skip turning on the XMLRPCDispatcher. Otherwise, you need to use declare it in config:

   request.dispatch: cherrypy.dispatch.XMLRPCDispatcher()
Instance Methods [hide private]
 
default(self, *vpath, **params) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  _cp_config = {'tools.xmlrpc.on': True}
Properties [hide private]

Inherited from object: __class__