[sysadmin-bin] Bring the results of the queries into another loop to properly generate the emails to subscribe on f



commit 29ccd8393ba886c10d81d08b6cf07b92ccc272a7
Author: Andrea Veri <av gnome org>
Date:   Thu May 8 17:45:03 2014 +0200

    Bring the results of the queries into another loop to properly generate the emails to subscribe on 
foundation-announce

 membership/foundation-db-operations.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/membership/foundation-db-operations.py b/membership/foundation-db-operations.py
index 065fc57..64ad1b9 100755
--- a/membership/foundation-db-operations.py
+++ b/membership/foundation-db-operations.py
@@ -225,16 +225,16 @@ def subscribe_new_members():
     queries = ["SELECT email from foundationmembers WHERE TO_DAYS(last_renewed_on)=To_DAYS(NOW());",
                "SELECT email from foundationmembers WHERE TO_DAYS(first_added)=To_DAYS(NOW());"]
 
+    f = open('/tmp/new_subscribers', 'w')
+
     for query in queries:
         new_members = query_database_with(query)
 
-    f = open('/tmp/new_subscribers', 'w')
-
-    for row in new_members:
-        f.write (str(row[0]) + "\n")
-        f.close()
+        for row in new_members:
+            f.write (str(row[0]) + "\n")
+            f.close()
 
-    if os.path.getsize('/tmp/new_subscribers') == '0':
+    if os.path.getsize('/tmp/new_subscribers') == 0:
         os.remove('/tmp/new_subscribers')
     else:
         subscribe = subprocess.Popen(['/usr/lib/mailman/bin/add_members', '-a', 'n', '-r', 
'/tmp/new_subscribers', 'foundation-announce'])


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