From 6d4d56db72a0d854239442c22ef896f67637e0c2 Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Sun, 21 Sep 2014 17:31:21 +0200 Subject: [PATCH] methode mail: adresse de contact d'un adh --- objets.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/objets.py b/objets.py index d1ba3c2..e9c7115 100644 --- a/objets.py +++ b/objets.py @@ -951,6 +951,17 @@ class proprio(CransLdapObject): machine.delete(comm, login) super(proprio, self).delete(comm, login) + def get_mail(self): + """Renvoie un mail de contact valide, or None""" + mails = ( self.get('canonicalAlias', []) or \ + self.get('mail', [])) + if not mails or \ + any(b['type'] == 'mail_invalide' and b['fin'] == '-' + for b in self.get('blacklist', []) ): + return None + return mails[0].value + + class machine(CransLdapObject): u""" Une machine """ can_be_by = { variables.created: [attributs.nounou, attributs.bureau, attributs.cableur, attributs.parent, attributs.respo],