# HG changeset patch # User Denis Laxalde # Date 1516801261 -3600 # Node ID afc678253bc2713f844cbf877a02bb6b5e9f970d # Parent 676c166bbd74b6b5861c47bdbdc529dfbc520cbe [py3] Drop a couple of unicode() in devtools.testlib diff -r 676c166bbd74 -r afc678253bc2 cubicweb/devtools/testlib.py --- a/cubicweb/devtools/testlib.py Wed Jan 24 14:38:39 2018 +0100 +++ b/cubicweb/devtools/testlib.py Wed Jan 24 14:41:01 2018 +0100 @@ -29,7 +29,7 @@ from itertools import chain from warnings import warn -from six import text_type, string_types, reraise +from six import binary_type, text_type, string_types, reraise from six.moves import range from six.moves.urllib.parse import urlparse, parse_qs, unquote as urlunquote @@ -758,7 +758,7 @@ req.form will be setup using the url's query string """ req = self.request(url=url) - if isinstance(url, unicode): + if isinstance(url, text_type): url = url.encode(req.encoding) # req.setup_params() expects encoded strings querystring = urlparse(url)[-2] params = parse_qs(querystring) @@ -772,7 +772,7 @@ req.form will be setup using the url's query string """ with self.admin_access.web_request(url=url) as req: - if isinstance(url, unicode): + if isinstance(url, text_type): url = url.encode(req.encoding) # req.setup_params() expects encoded strings querystring = urlparse(url)[-2] params = parse_qs(querystring) @@ -1024,8 +1024,8 @@ position = getattr(exc, "position", (0,))[0] if position: # define filter - if isinstance(content, str): - content = unicode(content, sys.getdefaultencoding(), 'replace') + if isinstance(content, binary_type): + content = text_type(content, sys.getdefaultencoding(), 'replace') content = validator.preprocess_data(content) content = content.splitlines() width = int(log(len(content), 10)) + 1