aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrysn <chrysn@fsfe.org>2014-03-12 11:11:14 +0100
committerchrysn <chrysn@fsfe.org>2014-03-12 11:11:14 +0100
commit81506fae8a6d5360f6d830b0e07190e60a7efd1c (patch)
tree6448c6c509035ac9bb098b63a308f9713f310798
parentc41d47cff0c6a92234ee8694c396e497782cf802 (diff)
downloadikiwiki-81506fae8a6d5360f6d830b0e07190e60a7efd1c.tar
ikiwiki-81506fae8a6d5360f6d830b0e07190e60a7efd1c.tar.gz
partially revert 154c4ea9e
explicitly en- and decoding xmlrpc requests in the python proxy broke plugins on debian sid, while it was introduced to fix breakage in debian stable. it is assumed that an xml module involved changed its behavior from str to unicode, this patch handles both cases.
-rwxr-xr-xplugins/proxy.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/proxy.py b/plugins/proxy.py
index d70a967a5..e8782e6e4 100755
--- a/plugins/proxy.py
+++ b/plugins/proxy.py
@@ -158,15 +158,23 @@ class _IkiWikiExtPluginXMLRPCHandler(object):
def send_rpc(self, cmd, in_fd, out_fd, *args, **kwargs):
xml = _xmlrpc_client.dumps(sum(kwargs.items(), args), cmd)
self._debug_fn(
- "calling ikiwiki procedure `{0}': [{1}]".format(cmd, xml))
- _IkiWikiExtPluginXMLRPCHandler._write(out_fd, xml.encode('utf8'))
+ "calling ikiwiki procedure `{0}': [{1}]".format(cmd, repr(xml)))
+ if isinstance(xml, unicode):
+ encoded = xml.encode('utf8')
+ else:
+ encoded = xml
+ _IkiWikiExtPluginXMLRPCHandler._write(out_fd, encoded)
self._debug_fn('reading response from ikiwiki...')
- xml = _IkiWikiExtPluginXMLRPCHandler._read(in_fd).decode('utf8')
+ response = _IkiWikiExtPluginXMLRPCHandler._read(in_fd)
+ if isinstance(response, unicode):
+ xml = response.encode('utf8')
+ else:
+ xml = response
self._debug_fn(
'read response to procedure {0} from ikiwiki: [{1}]'.format(
- cmd, xml))
+ cmd, repr(xml)))
if xml is None:
# ikiwiki is going down
self._debug_fn('ikiwiki is going down, and so are we...')