[sysadmin-bin] Add a function to generate the membership list that will appear at http://www.gnome.org/foundation/m



commit c97ca8e6d4ace780654558d1fcfca9f73d2672e6
Author: Andrea Veri <av gnome org>
Date:   Wed Oct 8 18:04:31 2014 +0200

    Add a function to generate the membership list that will appear at 
http://www.gnome.org/foundation/membership

 membership/foundation-operations.py |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/membership/foundation-operations.py b/membership/foundation-operations.py
index 29c034a..70b30cd 100755
--- a/membership/foundation-operations.py
+++ b/membership/foundation-operations.py
@@ -30,6 +30,10 @@ parser.add_option("--remove-expired-foundation-members",
                   action="store_true", default=False,
                   help="Foundation membership lasts two years, remove expired members from the "
                        "foundation LDAP group")
+parser.add_option("--generate-membership-list",
+                  action="store_true", default=False,
+                  help="Generate and publish the Foundation membership list that will appear at "
+                       "http://www.gnome.org/foundation/membership";)
 
 (options, args) = parser.parse_args()
 
@@ -123,6 +127,28 @@ 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)
 
+def generate_membership_list():
+    foundationmembers = _get_foundation_members()
+    
+    membershiplist = []
+    membershipdict = {}
+    result = []
+
+    for member in foundationmembers:
+        common_name_attr = _get_attributes_from_ldap(member, 'cn')
+        membershiplist.append(common_name_attr)
+
+    for cn in membershiplist:
+        d = { 'common_name' : cn }
+        result.append(d)
+
+        memberslist = json.dumps(result, encoding='utf8')
+
+    membershipfile = open('/var/www/html/foundation/membershiplist', 'w')
+    membershipfile.write(memberslist)
+    membershipfile.close()
+
+
 def send_form_letters(form_letter, email, name):
     try:
         msg = MIMEText(form_letter)
@@ -276,5 +302,8 @@ def main():
     if options.remove_expired_foundation_members:
         remove_expired_memberships_from_foundation()
 
+    if options.generate_membership_list:
+        generate_membership_list()
+
 if __name__ == "__main__":
     main()


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