# HG changeset patch # User Laurent Peuch # Date 1576739602 -3600 # Node ID 71a842bdf81d8c104146a0ee800c6b21564ca77b # Parent bc623a3e44e9823ec3a0f4d6c47959f16a09436d [python3] replace 'unicode' by 'str' diff -r bc623a3e44e9 -r 71a842bdf81d cubicweb/ext/tal.py --- a/cubicweb/ext/tal.py Tue Dec 17 21:21:55 2019 +0100 +++ b/cubicweb/ext/tal.py Thu Dec 19 08:13:22 2019 +0100 @@ -207,7 +207,7 @@ :param template: path of the file to compile """ fp = open(filepath) - file_content = unicode(fp.read()) # template file should be pure ASCII + file_content = str(fp.read()) # template file should be pure ASCII fp.close() return compile_template(file_content) diff -r bc623a3e44e9 -r 71a842bdf81d cubicweb/misc/migration/3.23.0_Any.py --- a/cubicweb/misc/migration/3.23.0_Any.py Tue Dec 17 21:21:55 2019 +0100 +++ b/cubicweb/misc/migration/3.23.0_Any.py Thu Dec 19 08:13:22 2019 +0100 @@ -61,7 +61,7 @@ rdef = cwrdef.yams_schema() cstr = rdef.constraint_by_eid(cwconstraint.eid) with cnx.deny_all_hooks_but(): - cwconstraint.cw_set(value=unicode(cstr.serialize())) + cwconstraint.cw_set(value=str(cstr.serialize())) if cstr.type() not in ('BoundaryConstraint', 'IntervalBoundConstraint', 'StaticVocabularyConstraint'): # These cannot be translate into backend CHECK. diff -r bc623a3e44e9 -r 71a842bdf81d cubicweb/server/serverctl.py --- a/cubicweb/server/serverctl.py Tue Dec 17 21:21:55 2019 +0100 +++ b/cubicweb/server/serverctl.py Thu Dec 19 08:13:22 2019 +0100 @@ -529,18 +529,18 @@ if not sourceuri: print('-> mandatory.') else: - sourceuri = unicode(sourceuri, sys.stdin.encoding) + sourceuri = str(sourceuri, sys.stdin.encoding) if sourceuri in used: print('-> uri already used, choose another one.') else: break url = input('source URL (leave empty for none): ').strip() - url = unicode(url) if url else None + url = str(url) if url else None # XXX configurable inputlevel sconfig = ask_source_config(config, type, inputlevel=self.config.config_level) - cfgstr = unicode(generate_source_config(sconfig), sys.stdin.encoding) - cnx.create_entity('CWSource', name=sourceuri, type=unicode(type), - config=cfgstr, parser=unicode(parser), url=unicode(url)) + cfgstr = str(generate_source_config(sconfig), sys.stdin.encoding) + cnx.create_entity('CWSource', name=sourceuri, type=str(type), + config=cfgstr, parser=str(parser), url=str(url)) cnx.commit() finally: repo.hm.call_hooks('server_shutdown') diff -r bc623a3e44e9 -r 71a842bdf81d cubicweb/web/htmlwidgets.py --- a/cubicweb/web/htmlwidgets.py Tue Dec 17 21:21:55 2019 +0100 +++ b/cubicweb/web/htmlwidgets.py Thu Dec 19 08:13:22 2019 +0100 @@ -302,10 +302,9 @@ value = self._rows[rowindex][colindex] if value is None: return u'' - elif isinstance(value, int): + if isinstance(value, int): return u'%09d' % value - else: - return unicode(value) + return str(value) class TableWidget(HTMLWidget): diff -r bc623a3e44e9 -r 71a842bdf81d cubicweb/web/views/calendar.py --- a/cubicweb/web/views/calendar.py Tue Dec 17 21:21:55 2019 +0100 +++ b/cubicweb/web/views/calendar.py Thu Dec 19 08:13:22 2019 +0100 @@ -101,8 +101,8 @@ elt.add(stop_kw).value = ical_task.stop buff = ical.serialize() - if not isinstance(buff, unicode): - buff = unicode(buff, self._cw.encoding) + if not isinstance(buff, str): + buff = str(buff, self._cw.encoding) self.w(buff) except ImportError: diff -r bc623a3e44e9 -r 71a842bdf81d cubicweb/web/views/sparql.py --- a/cubicweb/web/views/sparql.py Tue Dec 17 21:21:55 2019 +0100 +++ b/cubicweb/web/views/sparql.py Thu Dec 19 08:13:22 2019 +0100 @@ -119,7 +119,7 @@ sparql = E.sparql(E.head(*(E.variable(name=name) for name in varnames)), results) self.w(u'\n') - self.w(etree.tostring(sparql, encoding=unicode, pretty_print=True)) + self.w(etree.tostring(sparql, encoding=str, pretty_print=True)) def cell_binding(self, row, col, varname): celltype = self.cw_rset.description[row][col]