summaryrefslogtreecommitdiff
path: root/cron
diff options
context:
space:
mode:
authormailman1998-04-10 00:35:20 +0000
committermailman1998-04-10 00:35:20 +0000
commite17dd089e09778ad3652c9ec247cce36600a3d02 (patch)
tree1cbcee399d07f72b86f0ce8e3aa1dddb35d6b38e /cron
parent50f57f55896ea39b7fbf5af772ea90504c67a821 (diff)
downloadmailman-e17dd089e09778ad3652c9ec247cce36600a3d02.tar.gz
mailman-e17dd089e09778ad3652c9ec247cce36600a3d02.tar.zst
mailman-e17dd089e09778ad3652c9ec247cce36600a3d02.zip
Push the main code into a function, instead of inline.
Diffstat (limited to 'cron')
-rwxr-xr-xcron/mailpasswds48
1 files changed, 26 insertions, 22 deletions
diff --git a/cron/mailpasswds b/cron/mailpasswds
index 0db576908..8bd9f47bd 100755
--- a/cron/mailpasswds
+++ b/cron/mailpasswds
@@ -6,7 +6,7 @@ We accumulate users and their passwords, and use the last list to send a
single message to each user with their complete collection of passwords,
rather than sending a single message for each password."""
-__version__ = "$Revision: 388 $"
+__version__ = "$Revision: 408 $"
# This puppy should probably do lots of logging.
@@ -69,25 +69,29 @@ def MailAllPasswords(list, users):
sender = mm_cfg.MAILMAN_OWNER,
add_headers = ["X-No-Archive: yes"])
-# Consolidate all the list/url/password info for each user, so we send
-# the user a single message with the info for all their lists on this
-# site.
-list = None
-for name in mm_utils.list_names():
- list = maillist.MailList(name)
- list_name = list.real_name
- for user, password in list.passwords.items():
- url = list.GetOptionsURL(user)
- if users.has_key(user):
- users[user].append(list_name, password, url)
- else:
- users[user] = [(list_name, password, url)]
- # Unlocking each list after identifying passwords, but before having
- # the consolidated list, means that there is a window for discrepancy
- # between the reported and actual password. Big deal - if the user
- # changed the password in the meanwhile, they'll realize it, and it's
- # not worth the extra deadlock risk.
- list.Unlock()
+def main():
+ """Consolidate all the list/url/password info for each user, so we send
+ the user a single message with the info for all their lists on this
+ site."""
+ list = None
+ for name in mm_utils.list_names():
+ list = maillist.MailList(name)
+ list_name = list.real_name
+ for user, password in list.passwords.items():
+ url = list.GetOptionsURL(user)
+ if users.has_key(user):
+ users[user].append(list_name, password, url)
+ else:
+ users[user] = [(list_name, password, url)]
+ # Unlocking each list after identifying passwords, but before having
+ # the consolidated list, means that there is a window for discrepancy
+ # between the reported and actual password. Big deal - if the user
+ # changed the password in the meanwhile, they'll realize it, and it's
+ # not worth the extra deadlock risk.
+ list.Unlock()
+
+ if list:
+ MailAllPasswords(list, users)
-if list:
- MailAllPasswords(list, users)
+if __name__ == "__main__":
+ main()