[Mailman-Developers] mailpasswds is brittle

2003-07-23 Thread Les Niles
I just ran into a problem with the monthly password reminders.
They haven't been going out on some of our lists for several
months.  I was able to ignore this for quite a while under the
theory that it would be fixed when we upgraded from a beta to a
final version of mailman.  Then we did the upgrade and there still
weren't any reminders.  Turns out one of the lists has a subscriber
who has no password entry; this causes mlist.getMemberPassword() to
throw an exception which is not caught, which in turn causes
mailpasswds to abruptly exit at that point.  For some reason cron
didn't email me an exception traceback when this happened, but
that's another issue.  Anyway, I figured the right fix was to make
mailpasswds a little more robust.  Here's a patch against the 2.1.2
version, to catch these and possibly other exceptions and report
them a little more verbosely.

  -les  [EMAIL PROTECTED]

-

*** cron/mailpasswds.orig   Wed Jun 25 10:28:40 2003
--- cron/mailpasswdsWed Jul 23 11:25:25 2003
***
*** 136,152 
  for mlist in byhost[host]:
  listaddr = mlist.GetListEmail()
  for member in mlist.getMembers():
! # The user may have disabled reminders for this list
! if mlist.getMemberOption(member,
!  mm_cfg.SuppressPasswordReminder):
! continue
! # Group by the lower-cased address, since Mailman always
! # treates [EMAIL PROTECTED] the same as [EMAIL PROTECTED]
! password = mlist.getMemberPassword(member)
! optionsurl = mlist.GetOptionsURL(member)
! lang = mlist.getMemberLanguage(member)
! info = (listaddr, password, optionsurl, lang)
! userinfo.setdefault(member, []).append(info)
  # Now that we've collected user information for this host, send each
  # user the password reminder.
  for addr in userinfo.keys():
--- 136,159 
  for mlist in byhost[host]:
  listaddr = mlist.GetListEmail()
  for member in mlist.getMembers():
! try:
! # The user may have disabled reminders for this list
! if mlist.getMemberOption(member,
!  mm_cfg.SuppressPasswordReminder):
! continue
! # Group by the lower-cased address, since Mailman always
! # treates [EMAIL PROTECTED] the same as [EMAIL PROTECTED]
! password = mlist.getMemberPassword(member)
! optionsurl = mlist.GetOptionsURL(member)
! lang = mlist.getMemberLanguage(member)
! info = (listaddr, password, optionsurl, lang)
! userinfo.setdefault(member, []).append(info)
! except:
! err='mailpasswds: Exception %s (member %s, list %s): %s'%\
!   (member, sys.exc_info()[0], mlist.internal_name(), \
!sys.exc_info()[1])
! print  sys.stderr, err
! syslog('error', err)
  # Now that we've collected user information for this host, send each
  # user the password reminder.
  for addr in userinfo.keys():

___
Mailman-Developers mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-developers


Re: [Mailman-Developers] mailpasswds is brittle

2003-07-23 Thread Barry Warsaw
Thanks Les.  Note that this is already fixed in CVS (see mailpasswds
2.17), so it'll be part of MM2.1.3.  I likely won't get that out until
after Python 2.3 is released after the end of this month.

Cheers,
-Barry



___
Mailman-Developers mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-developers