methode mail: adresse de contact d'un adh

This commit is contained in:
Daniel STAN 2014-09-21 17:31:21 +02:00
parent 50efa40d8c
commit 6d4d56db72

View file

@ -951,6 +951,17 @@ class proprio(CransLdapObject):
machine.delete(comm, login) machine.delete(comm, login)
super(proprio, self).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): class machine(CransLdapObject):
u""" Une machine """ u""" Une machine """
can_be_by = { variables.created: [attributs.nounou, attributs.bureau, attributs.cableur, attributs.parent, attributs.respo], can_be_by = { variables.created: [attributs.nounou, attributs.bureau, attributs.cableur, attributs.parent, attributs.respo],