From f7036290d59863760e546f51902d80907ace5a3e Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Tue, 8 Oct 2013 10:17:56 +0200 Subject: [PATCH] =?UTF-8?q?[object]=20Blacklist=20virtuelle=20pour=20les?= =?UTF-8?q?=20gens=20non=20=C3=A0=20jour=20du=20paiement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- objets.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/objets.py b/objets.py index ecf9b3f..d513515 100644 --- a/objets.py +++ b/objets.py @@ -434,7 +434,7 @@ class CransLdapObject(object): out.append(u"%s : [%s] %s" % (date, author, u" ; ".join(mod_list))) return out - def blacklist_actif(self): + def blacklist_actif(self, excepts=[]): """Renvoie la liste des blacklistes actives sur l'entité Améliorations possibles: - Proposer de filtrer les blacklistes avec un arg supplémentaire ? @@ -449,9 +449,15 @@ class CransLdapObject(object): if self['chbre'][0].value == '????': bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'chambre_invalide', ''), {}, self.conn) blacklist_liste.append(bl) + elif self.__class__.__name__ == "adherent": + bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'paiement', ''), {}, self.conn) + blacklist_liste.append(bl) attrs = (self.attrs if self.mode not in ["w", "rw"] else self._modifs) blacklist_liste.extend(filter((lambda bl: bl.is_actif()), attrs.get("blacklist",[]))) - return blacklist_liste + if excepts: + return [ b for b in blacklist_liste if b.value['type'] not in excepts ] + else: + return blacklist_liste def blacklist(self, sanction, commentaire, debut="now", fin = '-'): """