classification
Title: please add wsgi to SimpleXMLRPCServer
Type: enhancement Stage: patch review
Components: XML Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Sanjeev, effbot, georg.brandl, gnarfk, loewis, r.david.murray, schmir
Priority: normal Keywords: patch

Created on 2007-06-30 13:31 by gnarfk, last changed 2013-06-25 17:48 by r.david.murray.

Files
File name Uploaded Description Edit
wsgi_xml_rpc.patch Sanjeev, 2013-03-18 23:06 review
wsgi_xml_rpc_pep8.patch r.david.murray, 2013-06-25 17:48 review
Messages (4)
msg55146 - (view) Author: Helmut Grohne (gnarfk) Date: 2007-06-30 13:31
There should be a simple wsgi xmlrpc application and in fact it is not difficult. You could for instance take this one and append it to SimpleXMLRPCServer.py.

class WSGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
    def __init__(self, allow_none=False, encoding=None):
        SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)
    def __call__(self, environ, start_response):
        """WSGI interface"""
        if environ["REQUEST_METHOD"] != "POST":
            status = "400 Bad request"
            headers = [("Content-type", "text/html")]
            data = "<html><head><title>400 Bad request</title></head><body><h1>400 Bad request</h1></body></html>"
            headers.append(("Content-length", str(len(data))))
            start_response(status, headers)
            if environ["REQUEST_METHOD"] == "HEAD":
                return []
            return [data]
        l = int(environ["CONTENT_LENGTH"])
        request = environ["wsgi.input"].read(l)
        response = self._marshaled_dispatch(request)
        headers = [("Content-type", "text/xml")]
        headers.append(("Content-length", str(len(response))))
        start_response("200 OK", headers)
        return [response]
msg55147 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-06-30 14:59
Assigned to Fredrik.
msg55814 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2007-09-11 06:20
A proper patch, including tests (if possible) and documentation, would
be nice.

(also note that SimpleXMLRPCServer was written by Brian Quinlan.)
msg191871 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-06-25 17:48
I've had a pep8-ification of this patch sitting on my disk for a while.  Uploading it here so it doesn't get lost.  It feels like there is a lot of redundancy now in the docs.  But, it also seems to make sense to provide a wsgi version of this.  So I'm inclined to commit it, but would appreciate second opinions.
History
Date User Action Args
2013-06-25 17:48:13r.david.murraysetfiles: + wsgi_xml_rpc_pep8.patch
nosy: + r.david.murray
messages: + msg191871

2013-03-19 08:13:35pitrousetnosy: + loewis

stage: patch review
2013-03-18 23:06:47Sanjeevsetversions: + Python 3.4, - Python 3.2
2013-03-18 23:06:28Sanjeevsetfiles: + wsgi_xml_rpc.patch
keywords: + patch
2013-03-18 18:43:32Sanjeevsetnosy: + Sanjeev
2010-07-09 05:25:43terry.reedysetversions: + Python 3.2, - Python 2.6
2008-03-14 19:29:50schmirsetnosy: + schmir
2008-01-06 12:30:17christian.heimessetversions: + Python 2.6
2007-09-11 06:20:18effbotsetassignee: effbot ->
messages: + msg55814
2007-06-30 13:31:58gnarfkcreate