Skip to content

Commit cb1f8b5

Browse files
committed
Handle string-to-bytes conversions for Python 3 for wsgi_handler.
1 parent 5e4c5d4 commit cb1f8b5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

roundup/cgi/wsgi_handler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import roundup.instance
1212
from roundup.cgi import TranslationService
1313
from roundup.anypy import http_
14+
from roundup.anypy.strings import s2b
1415
BaseHTTPRequestHandler = http_.server.BaseHTTPRequestHandler
1516
DEFAULT_ERROR_MESSAGE = http_.server.DEFAULT_ERROR_MESSAGE
1617

@@ -50,7 +51,7 @@ def __call__(self, environ, start_response):
5051
message, explain = BaseHTTPRequestHandler.responses[code]
5152
request.start_response([('Content-Type', 'text/html'),
5253
('Connection', 'close')], code)
53-
request.wfile.write(DEFAULT_ERROR_MESSAGE % locals())
54+
request.wfile.write(s2b(DEFAULT_ERROR_MESSAGE % locals()))
5455
return []
5556

5657
tracker = roundup.instance.open(self.home, not self.debug)
@@ -68,7 +69,7 @@ def __call__(self, environ, start_response):
6869
client.main()
6970
except roundup.cgi.client.NotFound:
7071
request.start_response([('Content-Type', 'text/html')], 404)
71-
request.wfile.write('Not found: %s'%client.path)
72+
request.wfile.write(s2b('Not found: %s'%client.path))
7273

7374
# all body data has been written using wfile
7475
return []

0 commit comments

Comments
 (0)