[Twisted-Python] More on XMLRPC

Hi. I just want to make sure that my conclusions are right: If I create an application using widgets, resource.Resource.getChild is used to traverse the URL to find the callable object. This traverse will always take place if resource.Resource.isLeaf is set to 0. The server.Request.process will then assume that we want to return html, and call render() on the object. After processing all childs, the page will be returned to the browser. The xmlrpc-implementation in xmlrpc.XMLRPC sets isLeaf to 1, which means that that the url wont be traversed, the only thing you can do is to use the _getFunction and traverse to the function manually, and return it. The useage of _getFunction is provided by overriding render. This means that you can't use anything in guard.ResourceGuard to protect your resources. Override isLeaf in the xmlrpc-class, and the url traversal wil take place, but server.Request isn't aware of anything but html, which means that it returns html to xmlrpc, which is not what we want. Not good at all... or am I wrong? Seems as if widgets and guards are only usable if you always, always only want to return html? /Magnus

Magnus Heino wrote:
The xmlrpc-implementation in xmlrpc.XMLRPC sets isLeaf to 1, which means that that the url wont be traversed, the only thing you can do is to use the _getFunction and traverse to the function manually, and return it. The useage of _getFunction is provided by overriding render. This means that you can't use anything in guard.ResourceGuard to protect your resources.
Override isLeaf in the xmlrpc-class, and the url traversal wil take place, but server.Request isn't aware of anything but html, which means that it returns html to xmlrpc, which is not what we want. Not good at all... or am I wrong?
You don't have to use twisted.web.xmlrpc if you don't want to - you can create your own class that does whatever you want. If you read the XML-RPC spec however you'll see that XML-RPC method path is *not* related to the URL, so you'll just end up doing the same thing I did. Please read the docs, everything will be clearer: http://www.xmlrpc.com/spec
participants (2)
-
Itamar Shtull-Trauring
-
Magnus Heino