diff roundup/cgi/templating.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 56c9bcdea47f
children 58057ea53779
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Wed Jul 25 09:07:03 2018 +0000
+++ b/roundup/cgi/templating.py	Wed Jul 25 09:08:29 2018 +0000
@@ -29,7 +29,7 @@
 from roundup import hyperdb, date, support
 from roundup import i18n
 from roundup.i18n import _
-from roundup.anypy.strings import is_us, us2s, s2u, u2s
+from roundup.anypy.strings import is_us, us2s, s2u, u2s, StringIO
 
 from .KeywordsExpr import render_keywords_expression_editor
 
@@ -44,10 +44,6 @@
 except ImportError:
     import pickle
 try:
-    import cStringIO as StringIO
-except ImportError:
-    import StringIO
-try:
     from StructuredText.StructuredText import HTML as StructuredText
 except ImportError:
     try: # older version
@@ -647,7 +643,7 @@
         """ Return the items of this class as a chunk of CSV text.
         """
         props = self.propnames()
-        s = StringIO.StringIO()
+        s = StringIO()
         writer = csv.writer(s)
         writer.writerow(props)
         check = self._client.db.security.hasPermission

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