[sysadmin-bin] Add a form letter for members that lost their membership after the two years timeline



commit 2803059158c4c366a3ed2c47b512042718834dbc
Author: Andrea Veri <av gnome org>
Date:   Tue Oct 14 18:59:02 2014 +0200

    Add a form letter for members that lost their membership after the two years timeline

 membership/foundation-operations.py |   73 ++++++++++++++++++++++++-----------
 1 files changed, 50 insertions(+), 23 deletions(-)
---
diff --git a/membership/foundation-operations.py b/membership/foundation-operations.py
index 830bd9a..641a6e6 100755
--- a/membership/foundation-operations.py
+++ b/membership/foundation-operations.py
@@ -122,10 +122,13 @@ def remove_expired_memberships_from_foundation():
     for member in foundationmembers:
         last_renewed_on_attr = _get_attributes_from_ldap(member, 'LastRenewedOn')
         convert_to_unix_time = calendar.timegm(strptime(last_renewed_on_attr, '%Y-%m-%d'))
+        mail_attr = _get_attributes_from_ldap(member,'mail')
 
         if member in foundationmembers and convert_to_unix_time < now - 365 * 2 * 24 * 60 * 60:
             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, member)
+                       
 
 def generate_membership_list():
     import json
@@ -167,6 +170,37 @@ def send_form_letters(form_letter, email, name):
     except smtplib.SMTPException:
         print "ERROR: I wasn't able to send the email correctly, please check /var/log/maillog!"
 
+
+def subscribe_new_members():
+    if socket.gethostname() != 'restaurant.gnome.org':
+        sys.exit("This function should only be used on restaurant.gnome.org")
+
+    foundationmembers = _get_foundation_members()
+
+    f = open('/tmp/new_subscribers', 'w')
+
+    for member in foundationmembers:
+        first_added_attr = _get_attributes_from_ldap(member, 'FirstAdded')
+        last_renewed_on_attr = _get_attributes_from_ldap(member, 'LastRenewedOn')
+        mail_attr = _get_attributes_from_ldap(member,'mail')
+
+        if first_added_attr == TODAY:
+            f.write(str(mail_attr) + '\n')
+        elif last_renewed_on_attr == TODAY:
+            f.write(str(mail_attr) + '\n')
+        else:
+            pass
+
+    f.close()
+
+    if os.path.getsize('/tmp/new_subscribers') == 0:
+        os.remove('/tmp/new_subscribers')
+    else:
+        import subprocess
+        subscribe = subprocess.Popen(['/usr/lib/mailman/bin/add_members', '-a', 'n', '-r', 
'/tmp/new_subscribers', 'foundation-announce'])
+        subscribe.wait()
+        os.remove('/tmp/new_subscribers')
+
 new_member_form_letter = """
 Dear GNOME contributor,
 
@@ -263,35 +297,28 @@ Best wishes,
 
 The GNOME Foundation Membership Committee"""
 
-def subscribe_new_members():
-    if socket.gethostname() != 'restaurant.gnome.org':
-        sys.exit("This function should only be used on restaurant.gnome.org")
+expired_membership_form_letter = """
+Hello!
 
-    foundationmembers = _get_foundation_members()
+from our records it seems your GNOME Foundation Membership expired! If you want
+to continue being a member of the GNOME Foundation please make sure to submit
+a renewal request at https://foundation.gnome.org/membership/apply.
 
-    f = open('/tmp/new_subscribers', 'w')
+More details on when your membership expired can be found on your profile page
+at https://account.gnome.org under the 'Last Renewed on date' field.
 
-    for member in foundationmembers:
-        first_added_attr = _get_attributes_from_ldap(member, 'FirstAdded')
-        last_renewed_on_attr = _get_attributes_from_ldap(member, 'LastRenewedOn')
-        mail_attr = _get_attributes_from_ldap(member,'mail')
+In the case you feel your contributions would not be enough for the membership
+renewal to happen you can apply for the Emeritus status:
 
-        if first_added_attr == TODAY:
-            f.write(str(mail_attr) + '\n')
-        elif last_renewed_on_attr == TODAY:
-            f.write(str(mail_attr) + '\n')
-        else:
-            pass
+  https://wiki.gnome.org/MembershipCommittee/EmeritusMembers
 
-    f.close()
+Additionally, please give a look at the Membership benefits:
+
+  https://wiki.gnome.org/MembershipCommittee/MembershipBenefits
+
+Thanks,
+  The GNOME Membership and Elections Committee"""
 
-    if os.path.getsize('/tmp/new_subscribers') == 0:
-        os.remove('/tmp/new_subscribers')
-    else:
-        import subprocess
-        subscribe = subprocess.Popen(['/usr/lib/mailman/bin/add_members', '-a', 'n', '-r', 
'/tmp/new_subscribers', 'foundation-announce'])
-        subscribe.wait()
-        os.remove('/tmp/new_subscribers')
 
 def main():
     if options.send_form_letters:


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