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],