diff roundup/cgi/wsgi_handler.py @ 5539:3a07c57d72bb

Handle string-to-bytes conversions for Python 3 for wsgi_handler.
author Joseph Myers <jsm@polyomino.org.uk>
date Sat, 15 Sep 2018 20:29:31 +0000
parents 277e91bf7936
children dccf9b7e5ee4
line wrap: on
line diff
--- a/roundup/cgi/wsgi_handler.py	Fri Sep 07 19:26:48 2018 -0400
+++ b/roundup/cgi/wsgi_handler.py	Sat Sep 15 20:29:31 2018 +0000
@@ -11,6 +11,7 @@
 import roundup.instance
 from roundup.cgi import TranslationService
 from roundup.anypy import http_
+from roundup.anypy.strings import s2b
 BaseHTTPRequestHandler = http_.server.BaseHTTPRequestHandler
 DEFAULT_ERROR_MESSAGE = http_.server.DEFAULT_ERROR_MESSAGE
 
@@ -50,7 +51,7 @@
             message, explain = BaseHTTPRequestHandler.responses[code]
             request.start_response([('Content-Type', 'text/html'),
                 ('Connection', 'close')], code)
-            request.wfile.write(DEFAULT_ERROR_MESSAGE % locals())
+            request.wfile.write(s2b(DEFAULT_ERROR_MESSAGE % locals()))
             return []
 
         tracker = roundup.instance.open(self.home, not self.debug)
@@ -68,7 +69,7 @@
             client.main()
         except roundup.cgi.client.NotFound:
             request.start_response([('Content-Type', 'text/html')], 404)
-            request.wfile.write('Not found: %s'%client.path)
+            request.wfile.write(s2b('Not found: %s'%client.path))
 
         # all body data has been written using wfile
         return []

Roundup Issue Tracker: http://roundup-tracker.org/