# HG changeset patch # User Rémi Cardona # Date 1442570592 -7200 # Node ID d5e3fffa9c07ba9ea67fb90f541070c8cdea7bde # Parent 3f4f190f8e353e0675d2aa61042ee5877eb4160b [py3k] unicode → six.text_type diff -r 3f4f190f8e35 -r d5e3fffa9c07 ext/rest.py --- a/ext/rest.py Fri Sep 18 11:58:29 2015 +0200 +++ b/ext/rest.py Fri Sep 18 12:03:12 2015 +0200 @@ -38,6 +38,7 @@ from logging import getLogger from os.path import join +from six import text_type from six.moves.urllib.parse import urlsplit from docutils import statemachine, nodes, utils, io @@ -396,7 +397,7 @@ the data formatted as HTML or the original data if an error occurred """ req = context._cw - if isinstance(data, unicode): + if isinstance(data, text_type): encoding = 'unicode' # remove unprintable characters unauthorized in xml data = data.translate(ESC_UCAR_TABLE) @@ -439,8 +440,8 @@ return res except BaseException: LOGGER.exception('error while publishing ReST text') - if not isinstance(data, unicode): - data = unicode(data, encoding, 'replace') + if not isinstance(data, text_type): + data = text_type(data, encoding, 'replace') return xml_escape(req._('error while publishing ReST text') + '\n\n' + data)