Home | Trees | Indices | Help |
|
---|
|
1 import sys 2 import xmlrpclib 3 4 import cherrypy 5 68 """Return (params, method) from request body.""" 9 try: 10 return xmlrpclib.loads(cherrypy.request.body.read()) 11 except Exception: 12 return ('ERROR PARAMS', ), 'ERRORMETHOD'13 1416 """Return 'path', doctored for RPC.""" 17 if not path.endswith('/'): 18 path += '/' 19 if path.startswith('/RPC2/'): 20 # strip the first /rpc2 21 path = path[5:] 22 return path23 2426 # The XML-RPC spec (http://www.xmlrpc.com/spec) says: 27 # "Unless there's a lower-level error, always return 200 OK." 28 # Since Python's xmlrpclib interprets a non-200 response 29 # as a "Protocol Error", we'll just return 200 every time. 30 response = cherrypy.response 31 response.status = '200 OK' 32 response.body = body 33 response.headers['Content-Type'] = 'text/xml' 34 response.headers['Content-Length'] = len(body)35 3638 _set_response(xmlrpclib.dumps((body,), methodresponse=1, 39 encoding=encoding, 40 allow_none=allow_none))41 45
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Thu Jan 24 16:33:15 2008 | http://epydoc.sourceforge.net |