Commit 996950b6 authored by Daniel Stan's avatar Daniel Stan

get_mail:les clubs n'ont ni mail ni canonicalAlias

parent 8892e905
......@@ -965,12 +965,16 @@ class proprio(CransLdapObject):
def get_mail(self):
"""Renvoie un mail de contact valide, or None"""
mails = ( self.get('canonicalAlias', []) or \
self.get('mail', []))
self.get('mail', []) or \
self.get('uid', []))
if not mails or \
any(b['type'] == 'mail_invalide' and b['fin'] == '-'
for b in self.get('blacklist', []) ):
return None
return mails[0].value
mail = mails[0].value
if '@' not in mail:
mail += '@crans.org'
return mail
class machine(CransLdapObject):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment