[sysadmin-bin] Send an e-mail to foundation-list with a list of expired members together with individual e-mails



commit a23eb201cea449fb2dc948c2d895e35f471d4c5f
Author: Andrea Veri <av gnome org>
Date:   Thu Dec 4 19:57:30 2014 +0100

    Send an e-mail to foundation-list with a list of expired members together with individual e-mails

 membership/foundation-operations.py |   39 ++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/membership/foundation-operations.py b/membership/foundation-operations.py
index 6e0d97b..99eafba 100755
--- a/membership/foundation-operations.py
+++ b/membership/foundation-operations.py
@@ -11,7 +11,7 @@ import os
 from email.mime.text import MIMEText
 from time import strftime, gmtime, strptime, localtime, time
 from optparse import OptionParser
-
+from datetime import date
 
 usage = "usage: %prog [options]"
 parser = OptionParser(usage)
@@ -127,6 +127,7 @@ def _sync_foundation_with_mailusers():
 
 def remove_expired_memberships_from_foundation():
     now = time()
+    members_list = ''
 
     for member in foundationmembers:
         last_renewed_on_attr = _get_attributes_from_ldap(member, 'LastRenewedOn')
@@ -138,6 +139,10 @@ def remove_expired_memberships_from_foundation():
             print "Removing %s from the foundation LDAP group as the membership expired on %s" % (member, 
last_renewed_on_attr)
             remove_user_from_foundation_member(member)
             send_form_letters(expired_membership_form_letter, mail_attr, common_name_attr)
+           
+            members_list += common_name_attr + ',' + ' ' + renewed_people[common_name_attr] + '\n'
+
+    send_form_letters(renewals_to_foundation_list, 'foundation-list gnome org', common_name_attr, 
members_list)
 
 
 def generate_membership_list():
@@ -164,12 +169,20 @@ def generate_membership_list():
         membershipfile.close()
 
 
-def send_form_letters(form_letter, email, name):
+def send_form_letters(form_letter, email, name, *args):
+    today = date.today()
+    year_month = str(today.year) + '-' + str(today.month) 
+
     try:
         msg = MIMEText(form_letter.safe_substitute (
                cn = name,
+               last_renewed_on_date = args[0],
+               expired_members = args[0],
         ))
-        msg['Subject'] = "Your GNOME Foundation Membership"
+        if form_letter == renewals_to_foundation_list:
+            msg['Subject'] = "Memberships needing renewal (%s)" % year_month  
+        else:
+            msg['Subject'] = "Your GNOME Foundation Membership"
         msg['From']    = "GNOME Foundation Membership Committee <noreply gnome org>"
         msg['To']      = "%s" % (email)
         msg['Reply-To']  = "membership-committee gnome org"
@@ -331,6 +344,26 @@ Additionally, please give a look at the Membership benefits:
 Thanks,
   The GNOME Membership and Elections Committee""")
 
+renewals_to_foundation_list = string.Template("""
+Hi,
+     
+as per point 1.3 of [1], here it comes a list of members in need of a
+renew in case they didn't receive their individual e-mail:
+     
+First name Last name (Last renewed on)
+
+$expired_members    
+     
+The Renewal form can be found at [2].
+     
+Cheers,
+   GNOME Membership and Elections Committee
+     
+[1] https://mail.gnome.org/archives/foundation-list/2011-November/msg00000.html
+[2] http://www.gnome.org/foundation/membership/apply/
+
+""")
+
 
 def main():
     if options.send_form_letters:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]