Commit 17070c10 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

avoid sanitizing warnings

parent 7dd84b69c7d4
......@@ -143,7 +143,7 @@ class IFTIndexableAdapter(view.EntityAdapter):
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:
......
......@@ -414,7 +414,7 @@ class IWorkflowableAdapter(EntityAdapter):
"""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)
......
......@@ -38,9 +38,9 @@ userwf = add_workflow(_('default user workflow'), 'CWUser')
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 @@ if hasattr(config, 'anonymous_user'):
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 @@ if interactive_mode:
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:
......
......@@ -280,7 +280,7 @@ def init_repository(config, interactive=True, drop=False, vreg=None,
# 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()
......
......@@ -1276,6 +1276,7 @@ class ServerMigrationHelper(MigrationHelper):
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)
......
......@@ -897,7 +897,7 @@ class NativeSQLSource(SQLAdapterMixIn, AbstractSource):
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment