Mercurial > p > roundup > code
diff roundup/scripts/roundup_server.py @ 5418:55f09ca366c4
Python 3 preparation: StringIO.
This generally arranges for StringIO and cStringIO references to use
io.StringIO for Python 3 but io.BytesIO for Python 2, consistent with
the string representations generally used in Roundup. A special
FasterStringIO in the TAL code, which referenced internals of the old
Python 2 StringIO module, is cut down so it doesn't actually do
anything beyond the StringIO class it inherits from (it would also be
reasonable to remove FasterStringIO completely). One place in
roundup_server.py clearly needing binary I/O is made to use io.BytesIO
unconditionally.
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Wed, 25 Jul 2018 09:08:29 +0000 |
| parents | d0816d50ee8f |
| children | 5dc27422f3ec |
line wrap: on
line diff
--- a/roundup/scripts/roundup_server.py Wed Jul 25 09:07:03 2018 +0000 +++ b/roundup/scripts/roundup_server.py Wed Jul 25 09:08:29 2018 +0000 @@ -36,8 +36,7 @@ # --/ -import errno, cgi, getopt, os, socket, sys, traceback, time -import StringIO +import errno, cgi, getopt, io, os, socket, sys, traceback, time try: # Python 3. @@ -64,6 +63,7 @@ # Roundup modules of use here from roundup.anypy import http_, urllib_ +from roundup.anypy.strings import StringIO from roundup.cgi import cgitb, client from roundup.cgi.PageTemplates.PageTemplate import PageTemplate import roundup.instance @@ -240,7 +240,7 @@ self.wfile.write(cgitb.breaker()) self.wfile.write(cgitb.html()) except: - s = StringIO.StringIO() + s = StringIO() traceback.print_exc(None, s) self.wfile.write("<pre>") self.wfile.write(cgi.escape(s.getvalue())) @@ -311,7 +311,7 @@ if favicon_fileobj is None: - favicon_fileobj = StringIO.StringIO(favico) + favicon_fileobj = io.BytesIO(favico) self.send_response(200) self.send_header('Content-Type', 'image/x-icon')
