Commit e97f8573 authored by Valentin Samir's avatar Valentin Samir

[ldap_locks] cast all the things ! python-ldap déteste l'unicode

parent 294773ba
......@@ -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('-')
......
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