--- mailman-2.0.99-cvs020111.orig/Mailman/Defaults.py.in +++ mailman-2.0.99-cvs020111/Mailman/Defaults.py.in @@ -706,6 +706,11 @@ # This variable controls whether monthly password reminders are sent. DEFAULT_SEND_REMINDERS = 1 +# 0 - yearly +# 1 - monthly +# 2 - quarterly +DEFAULT_SEND_REMINDERS_FREQUENCY = 1 + # Send welcome messages to new users? Probably should keep this set to 1. DEFAULT_SEND_WELCOME_MSG = 1 --- mailman-2.0.99-cvs020111.orig/Mailman/HTMLFormatter.py +++ mailman-2.0.99-cvs020111/Mailman/HTMLFormatter.py @@ -334,8 +334,14 @@ def FormatReminder(self, lang): if self.send_reminders: - return _('Once a month, your password will be emailed to you as' - ' a reminder.') + frequencies = [_('Once a year'), _('Once a month'), + _('Once in a quarter')] + try: + frequency = self.send_reminders_frequency + except: + frequency = 1 # monthly + return frequencies[frequency] + \ + _(', your password will be emailed to you as a reminder.') return '' def ParseTags(self, template, replacements, lang=None): --- mailman-2.0.99-cvs020111.orig/Mailman/MailList.py +++ mailman-2.0.99-cvs020111/Mailman/MailList.py @@ -288,6 +288,7 @@ self.umbrella_member_suffix = \ mm_cfg.DEFAULT_UMBRELLA_MEMBER_ADMIN_SUFFIX self.send_reminders = mm_cfg.DEFAULT_SEND_REMINDERS + self.send_reminders_frequency = mm_cfg.DEFAULT_SEND_REMINDERS_FREQUENCY self.send_welcome_msg = mm_cfg.DEFAULT_SEND_WELCOME_MSG self.send_goodbye_msg = mm_cfg.DEFAULT_SEND_GOODBYE_MSG self.bounce_matching_headers = \ --- mailman-2.0.99-cvs020111.orig/Mailman/Gui/General.py +++ mailman-2.0.99-cvs020111/Mailman/Gui/General.py @@ -237,6 +237,14 @@ per month to your members. Note that members may disable their own individual password reminders.''')), + ('send_reminders_frequency', mm_cfg.Radio, + (_('Yearly'), _('Monthly'), _('Quarterly')), 0, + _('How often should a password reminders be sent?'), + + _('''Frequency with which password reminders are sent to your + members. Note that members may disable their own individual + password reminders.''')), + ('welcome_msg', mm_cfg.Text, (4, WIDTH), 0, _('''List-specific text prepended to new-subscriber welcome message'''), --- mailman-2.0.99-cvs020111.orig/cron/crontab.in.in +++ mailman-2.0.99-cvs020111/cron/crontab.in.in @@ -11,7 +11,7 @@ 0 12 * * * @PYTHON@ -S @prefix@/cron/senddigests # # 5 AM on the first of each month, mail out password reminders. -0 5 1 * * @PYTHON@ -S @prefix@/cron/mailpasswds +0 5 1 * * @PYTHON@ -S @prefix@/cron/mailpasswds --cron # # Every 5 mins, try to gate news to mail. You can comment this one out # if you don't want to allow gating, or don't have any going on right now, --- mailman-2.0.99-cvs020111.orig/cron/mailpasswds +++ mailman-2.0.99-cvs020111/cron/mailpasswds @@ -29,6 +29,9 @@ Options: -h/--help Print this message and exit. + + -c/--cron + Called from cron and check for send_reminder_frequency. """ # This puppy should probably do lots of logging. @@ -36,6 +39,7 @@ import os import errno import getopt +import time import paths # mm_cfg must be imported before the other modules, due to the side-effect of @@ -66,17 +70,35 @@ +def time_to_send_reminders(mlist): + try: + freqency = mlist.send_reminders_frequency + else: + frequency = 1 # monthly + month = time.localtime()[1] + if frequency == 1: # monthly + return 1 + elif frequency == 0 and month == 1: # yearly + return 1 + elif frequency == 2 and month % 3 == 1: # quarterly + return 1 + return 0 + + def main(): try: - opts, args = getopt.getopt(sys.argv[1:], 'h', ['help']) + opts, args = getopt.getopt(sys.argv[1:], 'ch', ['cron', 'help']) except getopt.error, msg: usage(1, msg) if args: usage(1) + called_from_cron = 0 for opt, arg in opts: - if opt in ('-h', '--help'): + if opt in ('-c', '--cron'): + called_from_cron = 1 + elif opt in ('-h', '--help'): usage(0) # This is the list that all the reminders will look like they come from, @@ -97,6 +119,8 @@ for listname in Utils.list_names(): mlist = MailList.MailList(listname, lock=0) if not mlist.send_reminders: + continue + if called_from_cron and not time_to_send_reminders(mlist): continue if mm_cfg.VIRTUAL_HOST_OVERVIEW: host = mlist.host_name