From 0ae3aafcc2d93994a7e83414599ef7c91acc1be8 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 20 Jun 2018 21:14:51 +0000 Subject: [PATCH 64/64] Python 3 preparation: send bytes to socket in cgi/client.py. --- roundup/cgi/client.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py index 5b44d41..31b32b6 100644 --- a/roundup/cgi/client.py +++ b/roundup/cgi/client.py @@ -419,7 +419,7 @@ class Client: def handle_xmlrpc(self): if self.env.get('CONTENT_TYPE') != 'text/xml': - self.write("This is the endpoint of Roundup " + "XML-RPC interface.") return @@ -460,7 +460,7 @@ class Client: self.instance.actions, self.translator, allow_none=True) - output = handler.dispatch(input) + output = s2b(handler.dispatch(input)) self.setHeader("Content-Type", "text/xml") self.setHeader("Content-Length", str(len(output))) @@ -1792,7 +1792,9 @@ class Client: # client doesn't care about content return - if self.charset != self.STORAGE_CHARSET: + if sys.version_info[0] > 2: + content = content.encode(self.charset, 'xmlcharrefreplace') + elif self.charset != self.STORAGE_CHARSET: # recode output content = content.decode(self.STORAGE_CHARSET, 'replace') content = content.encode(self.charset, 'xmlcharrefreplace') -- 2.7.4