CherryPy / lib /

import sys
import xmlrpclib

import cherrypy

def process_body():
    """Return (params, method) from request body."""
        return xmlrpclib.loads(
    except Exception:
        return ('ERROR PARAMS', ), 'ERRORMETHOD'

def patched_path(path):
    """Return 'path', doctored for RPC."""
    if not path.endswith('/'):
        path += '/'
    if path.startswith('/RPC2/'):
        # strip the first /rpc2
        path = path[5:]
    return path

def _set_response(body):
    # The XML-RPC spec ( says:
    # "Unless there's a lower-level error, always return 200 OK."
    # Since Python's xmlrpclib interprets a non-200 response
    # as a "Protocol Error", we'll just return 200 every time.
    response = cherrypy.response
    response.status = '200 OK'
    response.body = body
    response.headers['Content-Type'] = 'text/xml'
    response.headers['Content-Length'] = len(body)

def respond(body, encoding='utf-8', allow_none=0):
    _set_response(xmlrpclib.dumps((body,), methodresponse=1,

def on_error():
    body = str(sys.exc_info()[1])
    _set_response(xmlrpclib.dumps(xmlrpclib.Fault(1, body)))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.