[PATCH 1 of 5] [py3] changing unicode to str

julien tayon julien.tayon at logilab.fr
Fri Jun 7 15:40:03 CEST 2019


# HG changeset patch
# User julien tayon <julien.tayon at logilab.fr>
# Date 1559633747 -7200
#      Tue Jun 04 09:35:47 2019 +0200
# Node ID a4a07c13d3a524d9010842a0f6dbcdc764645446
# Parent  76236807cb1d9e89eeb2d2bdef4b9a0a08319fad
[py3] changing unicode to str

py2 support being dropped, passing the code in full py3 str/bytes syntax

diff --git a/cubicweb/web/schemaviewer.py b/cubicweb/web/schemaviewer.py
--- a/cubicweb/web/schemaviewer.py
+++ b/cubicweb/web/schemaviewer.py
@@ -40,7 +40,7 @@ class SchemaViewer(object):
             self._ = req._
         else:
             encoding = 'ascii'
-            self._ = unicode
+            self._ = str
         self.encoding = encoding
 
     # no self.req managements
@@ -239,6 +239,6 @@ class SchemaViewer(object):
 
     def to_string(self, value):
         """used to converte arbitrary values to encoded string"""
-        if isinstance(value, unicode):
+        if isinstance(value, str):
             return value.encode(self.encoding, 'replace')
         return str(value)



More information about the cubicweb-devel mailing list