server/sources/native.py
changeset 10095 200bd6a601dc
parent 10086 98bc2ca1a816
child 10125 bc6461a7d2da
--- 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'},)