[session] take care of non-ascii characters in login and session id (closes: #1910849)
authorJulien Jehannet <julien.jehannet@logilab.fr>
Wed, 07 Sep 2011 17:50:09 +0200
changeset 7769 8af09eeee130
parent 7762 a3f9ba4d44eb
child 7776 aa547cf3bf0d
[session] take care of non-ascii characters in login and session id (closes: #1910849) We ensure a valid <str> conversion of the session id by using unormalize() at initialization.
server/session.py
--- a/server/session.py	Tue Sep 06 12:20:11 2011 +0200
+++ b/server/session.py	Wed Sep 07 17:50:09 2011 +0200
@@ -28,6 +28,7 @@
 from warnings import warn
 
 from logilab.common.deprecation import deprecated
+from logilab.common.textutils import unormalize
 from rql import CoercionError
 from rql.nodes import ETYPE_PYOBJ_MAP, etype_from_pyobj
 from yams import BASE_TYPES
@@ -232,7 +233,7 @@
 
     def __init__(self, user, repo, cnxprops=None, _id=None):
         super(Session, self).__init__(repo.vreg)
-        self.id = _id or make_uid(user.login.encode('UTF8'))
+        self.id = _id or make_uid(unormalize(user.login).encode('UTF8'))
         cnxprops = cnxprops or ConnectionProperties('inmemory')
         self.user = user
         self.repo = repo