avoid sanitizing warnings
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 26 Jun 2015 13:04:25 +0200
changeset 10473 23a2fa8cb725
parent 10472 7dd84b69c7d4
child 10474 1dcc52f5e340
avoid sanitizing warnings
entities/adapters.py
entities/wfobjs.py
misc/migration/postcreate.py
server/__init__.py
server/migractions.py
server/sources/native.py
--- a/entities/adapters.py	Fri Jun 26 14:04:16 2015 +0200
+++ b/entities/adapters.py	Fri Jun 26 13:04:25 2015 +0200
@@ -143,7 +143,7 @@
                 continue
             weight = self.attr_weight.get(rschema, 'C')
             try:
-                value = entity.printable_value(rschema, format='text/plain')
+                value = entity.printable_value(rschema, format=u'text/plain')
             except TransformError:
                 continue
             except Exception:
--- a/entities/wfobjs.py	Fri Jun 26 14:04:16 2015 +0200
+++ b/entities/wfobjs.py	Fri Jun 26 13:04:25 2015 +0200
@@ -414,7 +414,7 @@
         """return the default workflow for entities of this type"""
         # XXX CWEType method
         wfrset = self._cw.execute('Any WF WHERE ET default_workflow WF, '
-                                  'ET name %(et)s', {'et': self.entity.cw_etype})
+                                  'ET name %(et)s', {'et': unicode(self.entity.cw_etype)})
         if wfrset:
             return wfrset.get_entity(0, 0)
         self.warning("can't find any workflow for %s", self.entity.cw_etype)
--- a/misc/migration/postcreate.py	Fri Jun 26 14:04:16 2015 +0200
+++ b/misc/migration/postcreate.py	Fri Jun 26 13:04:25 2015 +0200
@@ -38,9 +38,9 @@
 activated = userwf.add_state(_('activated'), initial=True)
 deactivated = userwf.add_state(_('deactivated'))
 userwf.add_transition(_('deactivate'), (activated,), deactivated,
-                      requiredgroups=('managers',))
+                      requiredgroups=(u'managers',))
 userwf.add_transition(_('activate'), (deactivated,), activated,
-                      requiredgroups=('managers',))
+                      requiredgroups=(u'managers',))
 
 # create anonymous user if all-in-one config and anonymous user has been specified
 if hasattr(config, 'anonymous_user'):
@@ -50,7 +50,7 @@
         print 'Hopefully this is not a production instance...'
     elif anonlogin:
         from cubicweb.server import create_user
-        create_user(session, unicode(anonlogin), anonpwd, 'guests')
+        create_user(session, unicode(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():
@@ -63,7 +63,7 @@
     cfg.input_config(inputlevel=0)
     for section, options in cfg.options_by_section():
         for optname, optdict, value in options:
-            key = '%s.%s' % (section, optname)
+            key = u'%s.%s' % (section, optname)
             default = cfg.option_default(optname, optdict)
             # only record values differing from default
             if value != default:
--- a/server/__init__.py	Fri Jun 26 14:04:16 2015 +0200
+++ b/server/__init__.py	Fri Jun 26 13:04:25 2015 +0200
@@ -280,7 +280,7 @@
         # sort for eid predicatability as expected in some server tests
         for group in sorted(BASE_GROUPS):
             cnx.create_entity('CWGroup', name=unicode(group))
-        admin = create_user(cnx, login, pwd, 'managers')
+        admin = create_user(cnx, login, pwd, u'managers')
         cnx.execute('SET X owned_by U WHERE X is IN (CWGroup,CWSource), U eid %(u)s',
                         {'u': admin.eid})
         cnx.commit()
--- a/server/migractions.py	Fri Jun 26 14:04:16 2015 +0200
+++ b/server/migractions.py	Fri Jun 26 13:04:25 2015 +0200
@@ -1276,6 +1276,7 @@
             return 'missing workflow relations, see make_workflowable(%s)' % etype
         for etype in wfof:
             eschema = self.repo.schema[etype]
+            etype = unicode(etype)
             if ensure_workflowable:
                 assert 'in_state' in eschema.subjrels, _missing_wf_rel(etype)
                 assert 'custom_workflow' in eschema.subjrels, _missing_wf_rel(etype)
--- a/server/sources/native.py	Fri Jun 26 14:04:16 2015 +0200
+++ b/server/sources/native.py	Fri Jun 26 13:04:25 2015 +0200
@@ -897,7 +897,7 @@
         if extid is not None:
             assert isinstance(extid, str)
             extid = b64encode(extid)
-        attrs = {'type': entity.cw_etype, 'eid': entity.eid, 'extid': extid and unicode(extid),
+        attrs = {'type': unicode(entity.cw_etype), 'eid': entity.eid, 'extid': extid and unicode(extid),
                  'asource': unicode(source.uri)}
         self._handle_insert_entity_sql(cnx, self.sqlgen.insert('entities', attrs), attrs)
         # insert core relations: is, is_instance_of and cw_source