Send to both uwdir email and csclub email
authorDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Wed, 23 Jan 2008 21:39:40 +0000 (16:39 -0500)
committerDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Wed, 23 Jan 2008 21:39:40 +0000 (16:39 -0500)
* We were getting lots of bounces from uwdir emails (perhaps grads?)
* In the worse case, someone will get the email twice

ceo/console/main.py

index e3411fe..e65e328 100644 (file)
@@ -83,14 +83,15 @@ def expiredaccounts(args):
   for member in mlist.values():
     uid = member['uid'][0]
     name = member['cn'][0]
-    email = uid
-    user = uwl.search_s(uwldap.base(), ldap.SCOPE_SUBTREE,
-      '(uid=%s)' % ldapi.escape(uid))
-    if len(user) > 0  and 'mailLocalAddress' in user[0][1]:
-      email = user[0][1]['mailLocalAddress'][0]
+    email = None
     if send_email:
-      members.send_account_expired_email(name, email)
-    print '%s %s %s' % (uid.ljust(12), name.ljust(30), email)
+      members.send_account_expired_email(name, uid)
+      user = uwl.search_s(uwldap.base(), ldap.SCOPE_SUBTREE,
+        '(uid=%s)' % ldapi.escape(uid))
+      if len(user) > 0  and 'mailLocalAddress' in user[0][1]:
+        email = user[0][1]['mailLocalAddress'][0]
+        members.send_account_expired_email(name, email)
+    print '%s %s' % (uid.ljust(12), name.ljust(30))
 
 # list of commands
 commands = {