From 24721ddc9896d49e2e3df2c87595ab8928331cbd Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Sat, 8 Nov 2014 17:28:37 +0100 Subject: [PATCH] =?UTF-8?q?[objets]=20Lib=C3=A9ration=20du=20lock=20en=20c?= =?UTF-8?q?as=20d'op=C3=A9ration=20involutive=20sur=20un=20attribut=20non?= =?UTF-8?q?=20concurrent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Par exemple : adh['solde'][0]+=2 # acquisition du lock adh['solde'][0]-=2 # libération du lock --- objets.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/objets.py b/objets.py index 01fd579..64295bc 100644 --- a/objets.py +++ b/objets.py @@ -611,6 +611,9 @@ class CransLdapObject(object): for attribut in self._modifs.get(attr, []): if attribut.unique and not attribut in attrs_before_verif and not attribut in attribut.unique_exclue: self.conn.lockholder.removelock(attr, str(attribut), self.lockId) + # Si on remet la valeur antérieure au lock, on le libère + if not attribut.concurent and self._modifs.get(attr, []) != self.attrs.get(attr, []) and attrs_before_verif == self.attrs.get(attr, []): + self.conn.lockholder.removelock("dn", "%s_%s" % (self.dn.replace('=', '-').replace(',','_'), attr), self.lockId) # On met à jour self._modifs avec les nouvelles valeurs self._modifs[attr] = attrs_before_verif