aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2014-09-04 11:42:05 +0100
committerSimon McVittie <smcv@debian.org>2014-09-04 11:42:05 +0100
commit38bd51bc1bab0cabd97dfe3cb598220a2c02550a (patch)
tree9053fb362779da32806a4b89af587fd27618ba6a
parent81506fae8a6d5360f6d830b0e07190e60a7efd1c (diff)
downloadikiwiki-38bd51bc1bab0cabd97dfe3cb598220a2c02550a.tar
ikiwiki-38bd51bc1bab0cabd97dfe3cb598220a2c02550a.tar.gz
plugins/proxy.py: be compatible with Python 3
-rwxr-xr-xplugins/proxy.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/proxy.py b/plugins/proxy.py
index e8782e6e4..b61eb466c 100755
--- a/plugins/proxy.py
+++ b/plugins/proxy.py
@@ -159,7 +159,8 @@ class _IkiWikiExtPluginXMLRPCHandler(object):
xml = _xmlrpc_client.dumps(sum(kwargs.items(), args), cmd)
self._debug_fn(
"calling ikiwiki procedure `{0}': [{1}]".format(cmd, repr(xml)))
- if isinstance(xml, unicode):
+ # ensure that encoded is a str (bytestring in Python 2, Unicode in 3)
+ if str is bytes and not isinstance(xml, str):
encoded = xml.encode('utf8')
else:
encoded = xml
@@ -168,7 +169,7 @@ class _IkiWikiExtPluginXMLRPCHandler(object):
self._debug_fn('reading response from ikiwiki...')
response = _IkiWikiExtPluginXMLRPCHandler._read(in_fd)
- if isinstance(response, unicode):
+ if str is bytes and not isinstance(response, str):
xml = response.encode('utf8')
else:
xml = response