comparison roundup/cgi/PageTemplates/TALES.py @ 5416:56c9bcdea47f

Python 3 preparation: unicode. This patch introduces roundup/anypy/strings.py, which has a comment explaining the string representations generally used and common functions to handle the required conversions. Places in the code that explicitly reference the "unicode" type / built-in function are generally changed to use the new functions (or, in a few places where those new functions don't seem to fit well, other approaches such as references to type(u'') or use of the codecs module). This patch does not generally attempt to address text conversions in any places not currently referencing the "unicode" type (although scripts/import_sf.py is made to use binary I/O in places as fixing the "unicode" reference didn't seem coherent otherwise).
author Joseph Myers <jsm@polyomino.org.uk>
date Wed, 25 Jul 2018 09:05:58 +0000
parents d26921b851c3
children 883c9e90b403
comparison
equal deleted inserted replaced
5415:2d6a92c3e212 5416:56c9bcdea47f
229 229
230 def evaluateText(self, expr): 230 def evaluateText(self, expr):
231 text = self.evaluate(expr) 231 text = self.evaluate(expr)
232 if text is Default or text is None: 232 if text is Default or text is None:
233 return text 233 return text
234 if isinstance(text, unicode): 234 if isinstance(text, type(u'')):
235 return text 235 return text
236 else: 236 else:
237 return ustr(text) 237 return ustr(text)
238 238
239 def evaluateStructure(self, expr): 239 def evaluateStructure(self, expr):

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