Handle SimpleXMLRPCDispatcher arg count change in Py2.5
authormartin f. krafft <madduck@madduck.net>
Wed, 12 Mar 2008 13:23:09 +0000 (14:23 +0100)
committerJoey Hess <joey@kodama.kitenet.net>
Wed, 12 Mar 2008 14:46:36 +0000 (10:46 -0400)
SimpleXMLRPCDispatcher.__init__ takes 3 arguments instead of 1 since
python 2.5, so we check for that with a hack, for I found no better way,
other than catching a TypeError exception.

Signed-off-by: martin f. krafft <madduck@madduck.net>
doc/bugs/rst_plugin_traceback_with_SimpleXMLRPCDispatcher_from_pyhton_2.5.mdwn
plugins/rst

index 95f7b44bd29ea95b6f2522fe9ffae6ef1735f820..9997d383b84bfd98197078fd613e4ed102f4dd71 100644 (file)
@@ -9,3 +9,5 @@ After adding rst to plugins, ikiwiki --setup fails:
 
 This is ikiwiki version 2.40 and
 [SimpleXMLRPCServer.py](http://svn.python.org/view/python/tags/r25/Lib/SimpleXMLRPCServer.py?rev=51918&view=markup) from python-2.5
+
+[[done]]
index abf835e2ed01e297679bda0475a83cd5d1bf4756..1d18dd7751be2ad8771a25d76ccaad1e6ce41fa7 100755 (executable)
@@ -61,8 +61,12 @@ def rpc_call(cmd, **kwargs):
 
 class SimpleStdinOutXMLRPCHandler(SimpleXMLRPCDispatcher):
 
-    def __init__(self):
-        SimpleXMLRPCDispatcher.__init__(self)
+    def __init__(self, allow_none=False, encoding=None):
+        if SimpleXMLRPCDispatcher.__init__.func_code.co_argcount == 1:
+            # python2.4 and before only took one argument
+            SimpleXMLRPCDispatcher.__init__(self)
+        else:
+            SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)
 
     def process_request(self, req):
         write(self._marshaled_dispatch(req))