[warnings] put an end to warnings in the sqlite driver over `str` being sent instead of unicode strings
--- a/entities/__init__.py Wed May 14 15:05:31 2014 +0200
+++ b/entities/__init__.py Thu Nov 06 14:35:25 2014 +0100
@@ -34,8 +34,8 @@
@classproperty
def cw_etype(cls):
- """entity type as a string"""
- return cls.__regid__
+ """entity type as a unicode string"""
+ return unicode(cls.__regid__)
@classmethod
def cw_create_url(cls, req, **kwargs):
--- a/entities/wfobjs.py Wed May 14 15:05:31 2014 +0200
+++ b/entities/wfobjs.py Thu Nov 06 14:35:25 2014 +0100
@@ -87,7 +87,7 @@
def transition_by_name(self, trname):
rset = self._cw.execute('Any T, TN WHERE T name TN, T name %(n)s, '
'T transition_of WF, WF eid %(wf)s',
- {'n': trname, 'wf': self.eid})
+ {'n': unicode(trname), 'wf': self.eid})
if rset:
return rset.get_entity(0, 0)
return None
@@ -231,7 +231,7 @@
for gname in requiredgroups:
rset = self._cw.execute('SET T require_group G '
'WHERE T eid %(x)s, G name %(gn)s',
- {'x': self.eid, 'gn': gname})
+ {'x': self.eid, 'gn': unicode(gname)})
assert rset, '%s is not a known group' % gname
if isinstance(conditions, basestring):
conditions = (conditions,)
@@ -454,7 +454,7 @@
'Any T,TT, TN WHERE S allowed_transition T, S eid %(x)s, '
'T type TT, T type %(type)s, '
'T name TN, T transition_of WF, WF eid %(wfeid)s',
- {'x': self.current_state.eid, 'type': type,
+ {'x': self.current_state.eid, 'type': unicode(type),
'wfeid': self.current_workflow.eid})
for tr in rset.entities():
if tr.may_be_fired(self.entity.eid):
--- a/server/__init__.py Wed May 14 15:05:31 2014 +0200
+++ b/server/__init__.py Thu Nov 06 14:35:25 2014 +0100
@@ -196,7 +196,7 @@
user = session.create_entity('CWUser', login=login, upassword=pwd)
for group in groups:
session.execute('SET U in_group G WHERE U eid %(u)s, G name %(group)s',
- {'u': user.eid, 'group': group})
+ {'u': user.eid, 'group': unicode(group)})
return user
def init_repository(config, interactive=True, drop=False, vreg=None,
--- a/server/migractions.py Wed May 14 15:05:31 2014 +0200
+++ b/server/migractions.py Thu Nov 06 14:35:25 2014 +0100
@@ -1286,12 +1286,12 @@
assert 'wf_info_for' in eschema.objrels, _missing_wf_rel(etype)
rset = self.rqlexec(
'SET X workflow_of ET WHERE X eid %(x)s, ET name %(et)s',
- {'x': wf.eid, 'et': etype}, ask_confirm=False)
+ {'x': wf.eid, 'et': unicode(etype)}, ask_confirm=False)
assert rset, 'unexistant entity type %s' % etype
if default:
self.rqlexec(
'SET ET default_workflow X WHERE X eid %(x)s, ET name %(et)s',
- {'x': wf.eid, 'et': etype}, ask_confirm=False)
+ {'x': wf.eid, 'et': unicode(etype)}, ask_confirm=False)
if commit:
self.commit()
return wf
@@ -1326,7 +1326,7 @@
try:
prop = self.rqlexec(
'CWProperty X WHERE X pkey %(k)s, NOT X for_user U',
- {'k': pkey}, ask_confirm=False).get_entity(0, 0)
+ {'k': unicode(pkey)}, ask_confirm=False).get_entity(0, 0)
except Exception:
self.cmd_create_entity('CWProperty', pkey=unicode(pkey), value=value)
else:
--- a/server/schemaserial.py Wed May 14 15:05:31 2014 +0200
+++ b/server/schemaserial.py Thu Nov 06 14:35:25 2014 +0100
@@ -474,7 +474,7 @@
for i, name in enumerate(unique_together):
rschema = eschema.schema.rschema(name)
rtype = 'T%d' % i
- substs[rtype] = rschema.type
+ substs[rtype] = unicode(rschema.type)
relations.append('C relations %s' % rtype)
restrictions.append('%(rtype)s name %%(%(rtype)s)s' % {'rtype': rtype})
relations = ', '.join(relations)
--- a/server/sources/native.py Wed May 14 15:05:31 2014 +0200
+++ b/server/sources/native.py Thu Nov 06 14:35:25 2014 +0100
@@ -446,10 +446,10 @@
# XXX deprecates [un]map_attribute?
def map_attribute(self, etype, attr, cb, sourcedb=True):
- self._rql_sqlgen.attr_map['%s.%s' % (etype, attr)] = (cb, sourcedb)
+ self._rql_sqlgen.attr_map[u'%s.%s' % (etype, attr)] = (cb, sourcedb)
def unmap_attribute(self, etype, attr):
- self._rql_sqlgen.attr_map.pop('%s.%s' % (etype, attr), None)
+ self._rql_sqlgen.attr_map.pop(u'%s.%s' % (etype, attr), None)
def set_storage(self, etype, attr, storage):
storage_dict = self._storages.setdefault(etype, {})
@@ -894,8 +894,8 @@
if extid is not None:
assert isinstance(extid, str)
extid = b64encode(extid)
- attrs = {'type': entity.cw_etype, 'eid': entity.eid, 'extid': extid,
- 'asource': source.uri}
+ attrs = {'type': 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
try:
@@ -1473,7 +1473,7 @@
class LoginPasswordAuthentifier(BaseAuthentifier):
passwd_rql = 'Any P WHERE X is CWUser, X login %(login)s, X upassword P'
- auth_rql = ('Any X WHERE X is CWUser, X login %(login)s, X upassword %(pwd)s, '
+ auth_rql = (u'Any X WHERE X is CWUser, X login %(login)s, X upassword %(pwd)s, '
'X cw_source S, S name "system"')
_sols = ({'X': 'CWUser', 'P': 'Password', 'S': 'CWSource'},)
--- a/server/utils.py Wed May 14 15:05:31 2014 +0200
+++ b/server/utils.py Thu Nov 06 14:35:25 2014 +0100
@@ -81,7 +81,7 @@
if eschema.eid is None:
eschema.eid = cnx.execute(
'Any X WHERE X is CWEType, X name %(name)s',
- {'name': str(eschema)})[0][0]
+ {'name': unicode(eschema)})[0][0]
return eschema.eid