Update of /cvsroot/mailman/mailman/cron
In directory sc8-pr-cvs1:/tmp/cvs-serv5101/cron

Modified Files:
      Tag: Release_2_1-maint
        disabled gate_news mailpasswds 
Log Message:
Backporting from the HEAD -- bin and cron scripts




Index: disabled
===================================================================
RCS file: /cvsroot/mailman/mailman/cron/disabled,v
retrieving revision 2.8
retrieving revision 2.8.2.1
diff -u -d -r2.8 -r2.8.2.1
--- disabled    21 Oct 2002 22:36:57 -0000      2.8
+++ disabled    22 Sep 2003 02:29:51 -0000      2.8.2.1
@@ -1,19 +1,19 @@
 #! @PYTHON@
 #
-# Copyright (C) 2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2003 by the Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software 
+# along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 """Process disabled members, recommended once per day.
@@ -73,6 +73,7 @@
 from Mailman import MailList
 from Mailman import Pending
 from Mailman import MemberAdaptor
+from Mailman import Errors
 from Mailman.Bouncer import _BounceInfo
 from Mailman.Logging.Syslog import syslog
 from Mailman.i18n import _
@@ -198,7 +199,16 @@
             for member in notify:
                 syslog('bounce', 'Notifying disabled member %s for list: %s',
                        member, mlist.internal_name())
-                mlist.sendNextNotification(member)
+                try:
+                    mlist.sendNextNotification(member)
+                except Errors.NotAMemberError:
+                    # There must have been some problem with the data we have
+                    # on this member.  Most likely it's that they don't have a
+                    # password assigned.  Log this and delete the member.
+                    syslog('bounce',
+                           'NotAMemberError when sending disabled notice: %s',
+                           member)
+                    mlist.ApprovedDeleteMember(member, 'cron/disabled')
             mlist.Save()
         finally:
             mlist.Unlock()

Index: gate_news
===================================================================
RCS file: /cvsroot/mailman/mailman/cron/gate_news,v
retrieving revision 2.15
retrieving revision 2.15.2.1
diff -u -d -r2.15 -r2.15.2.1
--- gate_news   21 Oct 2002 22:36:57 -0000      2.15
+++ gate_news   22 Sep 2003 02:29:51 -0000      2.15.2.1
@@ -1,6 +1,6 @@
 #! @PYTHON@
 #
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -67,6 +67,13 @@
     pass
 
 
+try:
+    True, False
+except NameError:
+    True = 1
+    False = 0
+
+
 
 def usage(status, msg=''):
     if code:
@@ -83,12 +90,15 @@
 _hostcache = {}
 
 def open_newsgroup(mlist):
+    # Split host:port if given
+    nntp_host, nntp_port = Utils.nntpsplit(mlist.nntp_host)
     # Open up a "mode reader" connection to nntp server.  This will be shared
     # for all the gated lists having the same nntp_host.
     conn = _hostcache.get(mlist.nntp_host)
     if conn is None:
         try:
-            conn = nntplib.NNTP(mlist.nntp_host, readermode=1,
+            conn = nntplib.NNTP(nntp_host, nntp_port,
+                                readermode=True,
                                 user=mm_cfg.NNTP_USERNAME,
                                 password=mm_cfg.NNTP_PASSWORD)
         except (socket.error, nntplib.NNTPError, IOError), e:

Index: mailpasswds
===================================================================
RCS file: /cvsroot/mailman/mailman/cron/mailpasswds,v
retrieving revision 2.13.2.2
retrieving revision 2.13.2.3
diff -u -d -r2.13.2.2 -r2.13.2.3
--- mailpasswds 8 Feb 2003 07:13:51 -0000       2.13.2.2
+++ mailpasswds 22 Sep 2003 02:29:51 -0000      2.13.2.3
@@ -42,6 +42,7 @@
 import os
 import errno
 import getopt
+from types import UnicodeType
 
 import paths
 # mm_cfg must be imported before the other modules, due to the side-effect of
@@ -78,6 +79,13 @@
 
 
 
+def tounicode(s, enc):
+    if isinstance(s, UnicodeType):
+        return s
+    return unicode(s, enc, 'replace')
+
+
+
 def main():
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'l:h',
@@ -142,7 +150,15 @@
                     continue
                 # Group by the lower-cased address, since Mailman always
                 # treates [EMAIL PROTECTED] the same as [EMAIL PROTECTED]
-                password = mlist.getMemberPassword(member)
+                try:
+                    password = mlist.getMemberPassword(member)
+                except Errors.NotAMemberError:
+                    # Here's a member with no passwords, which I think was
+                    # possible in older versions of Mailman.  Log this and
+                    # move on.
+                    syslog('error', 'password-less member %s for list %s',
+                           member, mlist.internal_name())
+                    continue
                 optionsurl = mlist.GetOptionsURL(member)
                 lang = mlist.getMemberLanguage(member)
                 info = (listaddr, password, optionsurl, lang)
@@ -176,6 +192,7 @@
                 if cnt > langcnt:
                     poplang = lang
                     langcnt = cnt
+            enc = Utils.GetCharSet(poplang)
             # Craft the table header
             header = '%-40s %-10s\n%-40s %-10s' % (
                 _('List'), _('Password // URL'), '----', '--------')
@@ -190,6 +207,9 @@
                  'exreq'   : sitereq,
                  'owner'   : siteowner,
                  }, lang=poplang)
+            # Coerce everything to Unicode
+            text = tounicode(text, enc)
+            table = [tounicode(_t, enc) for _t in table]
             # Add the table to the end so it doesn't get wrapped/filled
             text += (header + '\n' + NL.join(table))
             # Translate the message and headers to user's suggested lang



_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins

Reply via email to