From b882c41683495fd1a5eabdf870decd8da4be4703 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Fri, 21 Feb 2014 18:02:02 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20des=20m=C3=A9thodes=20=5F=5Fne=5F=5F=20?= =?UTF-8?q?sur=20les=20cransLdapObjet=20et=20Attr=20pour=20tester=20le=20n?= =?UTF-8?q?on=20=C3=A9galit=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- attributs.py | 2 ++ objets.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/attributs.py b/attributs.py index 4239d0d..579c0a0 100644 --- a/attributs.py +++ b/attributs.py @@ -282,6 +282,8 @@ class Attr(object): def __getattr__(self, name): return getattr(self.value, name) + def __ne__(self, obj): + return not self == obj def __eq__(self, item): if isinstance(item, self.__class__): return str(self) == str(item) diff --git a/objets.py b/objets.py index 7954a10..bd876dc 100644 --- a/objets.py +++ b/objets.py @@ -162,6 +162,8 @@ class CransLdapObject(object): nvals = [nldif[attr][vals.index(v)] for v in vals ] raise EnvironmentError("λv. str(Attr(v)) n'est peut-être pas une projection (ie non idempotente):", attr, nvals, vals) + def __ne__(self, obj): + return not self == obj def __eq__(self, obj): if isinstance(obj, self.__class__): if self.mode in ['w', 'rw']: