[py3k] unicode → six.text_type
authorRémi Cardona <remi.cardona@logilab.fr>
Tue, 15 Sep 2015 18:39:09 +0200
changeset 10684 7e9c9a32f24f
parent 10683 e83de6c409fd
child 10685 44cb0e9df181
[py3k] unicode → six.text_type
misc/migration/3.10.0_Any.py
misc/migration/bootstrapmigration_repository.py
misc/migration/postcreate.py
--- a/misc/migration/3.10.0_Any.py	Tue Sep 15 18:30:05 2015 +0200
+++ b/misc/migration/3.10.0_Any.py	Tue Sep 15 18:39:09 2015 +0200
@@ -1,3 +1,5 @@
+from six import text_type
+
 from cubicweb.server.session import hooks_control
 
 for uri, cfg in config.read_sources_file().items():
@@ -24,7 +26,7 @@
     repo.sources_by_uri.pop(uri)
     config = u'\n'.join('%s=%s' % (key, value) for key, value in cfg.items()
                         if key != 'adapter' and value is not None)
-    create_entity('CWSource', name=unicode(uri), type=unicode(cfg['adapter']),
+    create_entity('CWSource', name=text_type(uri), type=text_type(cfg['adapter']),
                   config=config)
 commit()
 
--- a/misc/migration/bootstrapmigration_repository.py	Tue Sep 15 18:30:05 2015 +0200
+++ b/misc/migration/bootstrapmigration_repository.py	Tue Sep 15 18:39:09 2015 +0200
@@ -21,6 +21,8 @@
 """
 from __future__ import print_function
 
+from six import text_type
+
 from cubicweb import ConfigurationError
 from cubicweb.server.session import hooks_control
 from cubicweb.server import schemaserial as ss
@@ -149,7 +151,7 @@
                 default = yams.DATE_FACTORY_MAP[atype](default)
         else:
             assert atype == 'String', atype
-            default = unicode(default)
+            default = text_type(default)
         return Binary.zpickle(default)
 
     dbh = repo.system_source.dbhelper
--- a/misc/migration/postcreate.py	Tue Sep 15 18:30:05 2015 +0200
+++ b/misc/migration/postcreate.py	Tue Sep 15 18:39:09 2015 +0200
@@ -18,12 +18,14 @@
 """cubicweb post creation script, set user's workflow"""
 from __future__ import print_function
 
+from six import text_type
+
 # insert versions
 create_entity('CWProperty', pkey=u'system.version.cubicweb',
-              value=unicode(config.cubicweb_version()))
+              value=text_type(config.cubicweb_version()))
 for cube in config.cubes():
     create_entity('CWProperty', pkey=u'system.version.%s' % cube.lower(),
-                  value=unicode(config.cube_version(cube)))
+                  value=text_type(config.cube_version(cube)))
 
 # some entities have been added before schema entities, fix the 'is' and
 # 'is_instance_of' relations
@@ -51,7 +53,7 @@
         print('Hopefully this is not a production instance...')
     elif anonlogin:
         from cubicweb.server import create_user
-        create_user(session, unicode(anonlogin), anonpwd, u'guests')
+        create_user(session, text_type(anonlogin), anonpwd, u'guests')
 
 # need this since we already have at least one user in the database (the default admin)
 for user in rql('Any X WHERE X is CWUser').entities():