From e97f857310e4ab5ef9c73cb845b2c0b0f6ad6029 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Sun, 9 Nov 2014 23:35:34 +0100 Subject: [PATCH] =?UTF-8?q?[ldap=5Flocks]=20cast=20all=20the=20things=20!?= =?UTF-8?q?=20python-ldap=20d=C3=A9teste=20l'unicode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ldap_locks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ldap_locks.py b/ldap_locks.py index 469fda9..c23c201 100644 --- a/ldap_locks.py +++ b/ldap_locks.py @@ -135,6 +135,7 @@ class LdapLockHolder: tomber. """ try: + value = str(value) host, pid, begin = self.getlock(item, value) time_left = self.timeout - (time.time() - begin) if time_left <= 0: @@ -183,8 +184,9 @@ class LdapLockHolder: """ Libère le lock "$item=$value,$LOCKS_DN". """ + value = str(value) try: - if force or str(value) in self.locks[Id][item]: + if force or value in self.locks[Id][item]: self.conn.delete_s("%s=%s,%s" % (item, value, LOCKS_DN)) except ldap.NO_SUCH_OBJECT: pass @@ -201,7 +203,7 @@ class LdapLockHolder: Trouve le lock item=value, et renvoie le contenu de lockinfo via un triplet host, pid, begin """ - + value = str(value) try: result = self.conn.search_s('%s=%s,%s' % (item, value, LOCKS_DN), 0) host, pid, begin = result[0][1]['lockid'][0].split('-')