Skip to content

Commit e670a3d

Browse files
committed
Python 3 preparation: send bytes to socket in cgi/client.py.
1 parent 39e19b4 commit e670a3d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

roundup/cgi/client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def main(self):
438438

439439
def handle_xmlrpc(self):
440440
if self.env.get('CONTENT_TYPE') != 'text/xml':
441-
self.write("This is the endpoint of Roundup <a href='" +
441+
self.write(b"This is the endpoint of Roundup <a href='" +
442442
"http://www.roundup-tracker.org/docs/xmlrpc.html'>" +
443443
"XML-RPC interface</a>.")
444444
return
@@ -479,7 +479,7 @@ def handle_xmlrpc(self):
479479
self.instance.actions,
480480
self.translator,
481481
allow_none=True)
482-
output = handler.dispatch(input)
482+
output = s2b(handler.dispatch(input))
483483

484484
self.setHeader("Content-Type", "text/xml")
485485
self.setHeader("Content-Length", str(len(output)))
@@ -1811,7 +1811,9 @@ def write_html(self, content):
18111811
# client doesn't care about content
18121812
return
18131813

1814-
if self.charset != self.STORAGE_CHARSET:
1814+
if sys.version_info[0] > 2:
1815+
content = content.encode(self.charset, 'xmlcharrefreplace')
1816+
elif self.charset != self.STORAGE_CHARSET:
18151817
# recode output
18161818
content = content.decode(self.STORAGE_CHARSET, 'replace')
18171819
content = content.encode(self.charset, 'xmlcharrefreplace')

0 commit comments

Comments
 (0)