From 996950b6df44f93331dc7751a8358e1160b0413f Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Sun, 28 Sep 2014 15:52:47 +0200 Subject: [PATCH] get_mail:les clubs n'ont ni mail ni canonicalAlias --- objets.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/objets.py b/objets.py index 331d46a..ba99152 100644 --- a/objets.py +++ b/objets.py @@ -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):