From d8b1e5da518608e082af81d5331bad34625fbb19 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Wed, 26 Feb 2014 10:27:48 +0100 Subject: [PATCH] [objets] En cas d'ajout de lock hors contexte, on affiche un warning --- objets.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/objets.py b/objets.py index d0cf589..0a4dfd8 100644 --- a/objets.py +++ b/objets.py @@ -533,6 +533,8 @@ class CransLdapObject(object): try: for attribut in attrs_before_verif: if attribut.unique and not attribut in self._modifs.get(attr, []): + if not self.in_context: + cranslib.deprecated.usage("Des locks ne devrait être ajoutés que dans un context manager", level=2) self.conn.lockholder.addlock(attr, str(attribut), self.lockId) locked.append((attr, str(attribut), self.lockId)) except ldap_locks.LockError: