diff options
author | bwarsaw <> | 2005-12-30 18:50:08 +0000 |
---|---|---|
committer | bwarsaw <> | 2005-12-30 18:50:08 +0000 |
commit | d44c2c9f011075a7f6b6ffebe22ec3f17dda3a26 (patch) | |
tree | 6199ed049dba0f377f628b9c57a08b1ff9c3f500 | |
parent | 11ba661517e7606f5f38a8be87f68b32bff0afd4 (diff) | |
download | mailman2-d44c2c9f011075a7f6b6ffebe22ec3f17dda3a26.tar.gz mailman2-d44c2c9f011075a7f6b6ffebe22ec3f17dda3a26.tar.xz mailman2-d44c2c9f011075a7f6b6ffebe22ec3f17dda3a26.zip |
A cleansing pass, almost entirely cosmetic. Such things as whitespace
normalization, removal of tabs, copyright year updates to changed files,
docstring and comment fixes, and usage of True/False. I also made a pass
through the NEWS file.
One import was reordered, and after this commit I will move the mmdsr.readme
file to README.mmdsr.
From my perspective, after that we're ready to go.
I will port these changes forward to the trunk.
35 files changed, 275 insertions, 247 deletions
diff --git a/Mailman/Archiver/HyperArch.py b/Mailman/Archiver/HyperArch.py index 3fc5fadf..732ab10e 100644 --- a/Mailman/Archiver/HyperArch.py +++ b/Mailman/Archiver/HyperArch.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """HyperArch: Pipermail archiving for Mailman diff --git a/Mailman/Cgi/admin.py b/Mailman/Cgi/admin.py index b75ff2df..8434c817 100644 --- a/Mailman/Cgi/admin.py +++ b/Mailman/Cgi/admin.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Process and produce the list-administration options forms.""" diff --git a/Mailman/Cgi/admindb.py b/Mailman/Cgi/admindb.py index 3f421cfe..7f42c8ac 100644 --- a/Mailman/Cgi/admindb.py +++ b/Mailman/Cgi/admindb.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Produce and process the pending-approval items for a list.""" @@ -688,9 +689,9 @@ def process_form(mlist, doc, cgidata): senderactions.setdefault(sender, {})[action] = value # discard-all-defers try: - discardalldefersp = cgidata.getvalue('discardalldefersp', 0) + discardalldefersp = cgidata.getvalue('discardalldefersp', 0) except ValueError: - discardalldefersp = 0 + discardalldefersp = 0 for sender in senderactions.keys(): actions = senderactions[sender] # Handle what to do about all this sender's held messages @@ -698,8 +699,8 @@ def process_form(mlist, doc, cgidata): action = int(actions.get('senderaction', mm_cfg.DEFER)) except ValueError: action = mm_cfg.DEFER - if action == mm_cfg.DEFER and discardalldefersp: - action = mm_cfg.DISCARD + if action == mm_cfg.DEFER and discardalldefersp: + action = mm_cfg.DISCARD if action in (mm_cfg.DEFER, mm_cfg.APPROVE, mm_cfg.REJECT, mm_cfg.DISCARD): preserve = actions.get('senderpreserve', 0) diff --git a/Mailman/Cgi/confirm.py b/Mailman/Cgi/confirm.py index 6238e72a..6f31b6eb 100644 --- a/Mailman/Cgi/confirm.py +++ b/Mailman/Cgi/confirm.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Confirm a pending action via URL.""" @@ -792,7 +793,7 @@ def reenable_prompt(mlist, doc, cookie, list, member): <a href="%(listinfourl)s">list information page</a>.""")]) return - date = time.strftime('%A, %B %d, %Y', + date = time.strftime('%A, %B %d, %Y', time.localtime(time.mktime(info.date + (0,)*6))) daysleft = int(info.noticesleft * mlist.bounce_you_are_disabled_warnings_interval / diff --git a/Mailman/Cgi/create.py b/Mailman/Cgi/create.py index 661035c0..603a78e7 100644 --- a/Mailman/Cgi/create.py +++ b/Mailman/Cgi/create.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Create mailing lists through the web.""" diff --git a/Mailman/Cgi/edithtml.py b/Mailman/Cgi/edithtml.py index 1d36d5f6..2159985d 100644 --- a/Mailman/Cgi/edithtml.py +++ b/Mailman/Cgi/edithtml.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Script which implements admin editing of the list's html templates.""" diff --git a/Mailman/Cgi/private.py b/Mailman/Cgi/private.py index 7dcd39ca..35b38dea 100644 --- a/Mailman/Cgi/private.py +++ b/Mailman/Cgi/private.py @@ -15,8 +15,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. -"""Provide a password-interface wrapper around private archives. -""" +"""Provide a password-interface wrapper around private archives.""" import os import sys @@ -136,19 +135,18 @@ def main(): charset = Utils.GetCharSet(mlist.preferred_language) print 'Content-type: text/html; charset=' + charset + '\n\n' # Put the original full path in the authorization form, but avoid - # trailing slash if we're not adding parts. We add it below. + # trailing slash if we're not adding parts. We add it below. action = mlist.GetScriptURL('private', absolute=1) if parts[1:]: action = os.path.join(action, SLASH.join(parts[1:])) - # If we added '/index.html' to true_filename, add a slash to the - # URL. We need this because we no longer add the trailing slash in - # the private.html template. It's always OK to test parts[-1] - # since we've already verified parts[0] is listname. - # The basic rule is if the post URL (action) is a directory, it must - # be slash terminated, and not if it's a file. Otherwise, relative - # links in the target archive page don't work. - if true_filename.endswith('/index.html') and \ - parts[-1] <> 'index.html': + # If we added '/index.html' to true_filename, add a slash to the URL. + # We need this because we no longer add the trailing slash in the + # private.html template. It's always OK to test parts[-1] since we've + # already verified parts[0] is listname. The basic rule is if the + # post URL (action) is a directory, it must be slash terminated, but + # not if it's a file. Otherwise, relative links in the target archive + # page don't work. + if true_filename.endswith('/index.html') and parts[-1] <> 'index.html': action += SLASH print Utils.maketext( 'private.html', diff --git a/Mailman/Commands/cmd_confirm.py b/Mailman/Commands/cmd_confirm.py index 94075c30..efa405e3 100644 --- a/Mailman/Commands/cmd_confirm.py +++ b/Mailman/Commands/cmd_confirm.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """ confirm <confirmation-string> diff --git a/Mailman/Defaults.py.in b/Mailman/Defaults.py.in index eac2ad73..54f65c95 100644 --- a/Mailman/Defaults.py.in +++ b/Mailman/Defaults.py.in @@ -14,10 +14,10 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. -"""Distributed default settings for significant Mailman config variables. -""" +"""Distributed default settings for significant Mailman config variables.""" # NEVER make site configuration changes to this file. ALWAYS make them in # mm_cfg.py instead, in the designated area. See the comments in that file @@ -265,7 +265,7 @@ ARCHIVE_SCRUBBER = 'Mailman.Handlers.Scrubber' # 'attachement-xxx' instead. The default is set True because the applications # on PC and Mac begin to use longer non-ascii filenames. Historically, it # was set False in 2.1.6 for backward compatiblity but it was reset to True -# for safer operation in mailman-2.1.7. +# for safer operation in mailman-2.1.7. SCRUBBER_DONT_USE_ATTACHMENT_FILENAME = True # Use of attachment filename extension per se is may be dangerous because diff --git a/Mailman/Deliverer.py b/Mailman/Deliverer.py index edc03eb8..cb57e332 100644 --- a/Mailman/Deliverer.py +++ b/Mailman/Deliverer.py @@ -220,7 +220,8 @@ is required."""))) subject = _('%(listname)s mailing list probe message') finally: i18n.set_translation(otrans) - outer = Message.UserNotification(member, probeaddr, subject, lang=ulang) + outer = Message.UserNotification(member, probeaddr, subject, + lang=ulang) outer.set_type('multipart/mixed') text = MIMEText(text, _charset=Utils.GetCharSet(ulang)) outer.attach(text) diff --git a/Mailman/Gui/ContentFilter.py b/Mailman/Gui/ContentFilter.py index 167f42e2..a2fad54b 100644 --- a/Mailman/Gui/ContentFilter.py +++ b/Mailman/Gui/ContentFilter.py @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. -"""GUI component managing the content filtering options. -""" +"""GUI component managing the content filtering options.""" from Mailman import mm_cfg from Mailman.i18n import _ diff --git a/Mailman/Gui/Privacy.py b/Mailman/Gui/Privacy.py index b47cf382..5fe4a2d9 100644 --- a/Mailman/Gui/Privacy.py +++ b/Mailman/Gui/Privacy.py @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. -"""MailList mixin class managing the privacy options. -""" +"""MailList mixin class managing the privacy options.""" import re diff --git a/Mailman/Handlers/Approve.py b/Mailman/Handlers/Approve.py index 42b15e97..1ffd4388 100644 --- a/Mailman/Handlers/Approve.py +++ b/Mailman/Handlers/Approve.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Determine whether the message is approved for delivery. @@ -81,22 +82,22 @@ def process(mlist, msg, msgdata): part.set_payload(NL.join(lines)) stripped = True if stripped: - # MAS: Bug 1181161 - Now try all the text parts in case - # it's multipart/alternative with the approved line in - # HTML or other text part. We make a pattern from the - # approved line and delete it from all text/* parts in - # which we find it. It would be better to just iterate - # forward, but email compatability for pre Python 2.2 - # returns a list, not a true iterator. - # This will process all the multipart/alternative parts - # in the message as well as all other text parts. We - # shouldn't find the pattern outside the mp/a parts, but - # if we do, it is probably best to delete it anyway as it - # does contain the password. - # Make a pattern to delete. We can't just delete a line - # because line of HTML or other fancy text may include - # additional message text. This pattern works with HTML. - # It may not work with rtf or whatever else is possible. + # MAS: Bug 1181161 - Now try all the text parts in case it's + # multipart/alternative with the approved line in HTML or other + # text part. We make a pattern from the Approved line and delete + # it from all text/* parts in which we find it. It would be + # better to just iterate forward, but email compatability for pre + # Python 2.2 returns a list, not a true iterator. + # + # This will process all the multipart/alternative parts in the + # message as well as all other text parts. We shouldn't find the + # pattern outside the mp/a parts, but if we do, it is probably + # best to delete it anyway as it does contain the password. + # + # Make a pattern to delete. We can't just delete a line because + # line of HTML or other fancy text may include additional message + # text. This pattern works with HTML. It may not work with rtf + # or whatever else is possible. pattern = name + ':(\s| )*' + re.escape(passwd) for part in typed_subpart_iterator(msg, 'text'): if part is not None and part.get_payload() is not None: diff --git a/Mailman/Handlers/Cleanse.py b/Mailman/Handlers/Cleanse.py index b6e839bd..ea5a7fbf 100644 --- a/Mailman/Handlers/Cleanse.py +++ b/Mailman/Handlers/Cleanse.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Cleanse certain headers from all messages.""" diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py index eee5991e..8fd1d064 100644 --- a/Mailman/Handlers/CookHeaders.py +++ b/Mailman/Handlers/CookHeaders.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Cook a message's Subject header.""" @@ -247,16 +248,16 @@ def prefix_subject(mlist, msg, msgdata): if len(lines) > 1 and lines[1] and lines[1][0] in ' \t': ws = lines[1][0] msgdata['origsubj'] = subject - # The subject may be multilingual but we take the first charset - # as major one and try to decode. If it is decodable, returned - # subject is in one line and cset is properly set. If fail, - # subject is mime-encoded and cset is set as us-ascii. See detail - # for ch_oneline() (CookHeaders one line function). + # The subject may be multilingual but we take the first charset as major + # one and try to decode. If it is decodable, returned subject is in one + # line and cset is properly set. If fail, subject is mime-encoded and + # cset is set as us-ascii. See detail for ch_oneline() (CookHeaders one + # line function). subject, cset = ch_oneline(subject) - # TK: Python interpreter has eveolved to be strict on ascii charset - # code range. It is safe to use unicode string when manupilating - # header contents with re module. It would be best to return unicode - # in ch_oneline() but here is temporary solution. + # TK: Python interpreter has evolved to be strict on ascii charset code + # range. It is safe to use unicode string when manupilating header + # contents with re module. It would be best to return unicode in + # ch_oneline() but here is temporary solution. subject = unicode(subject, cset) # If the subject_prefix contains '%d', it is replaced with the # mailing list sequential number. Sequential number format allows @@ -316,7 +317,7 @@ def prefix_subject(mlist, msg, msgdata): else: h = uheader(mlist, prefix, 'Subject', continuation_ws=ws) h.append(recolon) - # TK: Subject is concatnated and unicode string. + # TK: Subject is concatenated and unicode string. subject = subject.encode(cset, 'replace') h.append(subject, cset) del msg['subject'] @@ -325,6 +326,7 @@ def prefix_subject(mlist, msg, msgdata): ss.append(subject, cset) msgdata['stripped_subject'] = ss + def ch_oneline(s): # Decode header string in one line and convert into single charset diff --git a/Mailman/Handlers/Decorate.py b/Mailman/Handlers/Decorate.py index 03266fae..a5df4010 100644 --- a/Mailman/Handlers/Decorate.py +++ b/Mailman/Handlers/Decorate.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Decorate a message by sticking the header and footer around it.""" diff --git a/Mailman/Handlers/MimeDel.py b/Mailman/Handlers/MimeDel.py index cf4ca6e8..906b12c3 100644 --- a/Mailman/Handlers/MimeDel.py +++ b/Mailman/Handlers/MimeDel.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """MIME-stripping filter for Mailman. @@ -90,7 +91,6 @@ def process(mlist, msg, msgdata): # headers. For now we'll move the subpart's payload into the outer part, # and then copy over its Content-Type: and Content-Transfer-Encoding: # headers (any others?). - # TK: Make this configurable from Gui/ContentFilter.py. if mlist.collapse_alternatives: collapse_multipart_alternatives(msg) if ctype == 'multipart/alternative': diff --git a/Mailman/Handlers/SMTPDirect.py b/Mailman/Handlers/SMTPDirect.py index 0d93073d..72b587e9 100644 --- a/Mailman/Handlers/SMTPDirect.py +++ b/Mailman/Handlers/SMTPDirect.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Local SMTP direct drop-off. @@ -135,11 +136,11 @@ def process(mlist, msg, msgdata): t0 = time.time() # Open the initial connection origrecips = msgdata['recips'] - # MAS: get the message sender now for logging. If we're using 'sender' - # and not 'from', bulkdeliver changes it for bounce processing. - # If we're VERPing, it doesn't matter because bulkdeliver is working - # on a copy, but otherwise msg gets changed. If the list is anonymous, - # the original sender is long gone, but Cleanse.py has logged it. + # MAS: get the message sender now for logging. If we're using 'sender' + # and not 'from', bulkdeliver changes it for bounce processing. If we're + # VERPing, it doesn't matter because bulkdeliver is working on a copy, but + # otherwise msg gets changed. If the list is anonymous, the original + # sender is long gone, but Cleanse.py has logged it. origsender = msgdata.get('original_sender', msg.get_sender()) # `undelivered' is a copy of chunks that we pop from to do deliveries. # This seems like a good tradeoff between robustness and resource diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py index edaa47d2..a0c4896c 100644 --- a/Mailman/Handlers/Scrubber.py +++ b/Mailman/Handlers/Scrubber.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Cleanse a message for archiving.""" @@ -162,9 +163,9 @@ def calculate_attachments_dir(mlist, msg, msgdata): def replace_payload_by_text(msg, text, charset): - # TK: This is a common function in replacing the attachment and - # the main message by a text (scrubbing). Plus a flag indicating - # it has been scrubbed. + # TK: This is a common function in replacing the attachment and the main + # message by a text (scrubbing). Also, add a flag indicating it has been + # scrubbed. del msg['content-type'] del msg['content-transfer-encoding'] msg.set_payload(text, charset) @@ -218,7 +219,7 @@ Url: %(url)s raise DiscardMessage replace_payload_by_text(part, _('HTML attachment scrubbed and removed'), - # Adding charset arg and removing content-tpe + # Adding charset arg and removing content-type # sets content-type to text/plain lcset) elif sanitize == 2: diff --git a/Mailman/Handlers/SpamDetect.py b/Mailman/Handlers/SpamDetect.py index b5f9d0b6..79dc40dc 100644 --- a/Mailman/Handlers/SpamDetect.py +++ b/Mailman/Handlers/SpamDetect.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2004 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2005 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 @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Do more detailed spam detection. @@ -67,7 +68,7 @@ class Tee: def write(self, s): self._outfp_a.write(s) self._outfp_b.write(s) - + # Class to capture the headers separate from the message body class HeaderGenerator(Generator): @@ -91,10 +92,9 @@ class HeaderGenerator(Generator): def process(mlist, msg, msgdata): - # Don't check if the message has been approved OR it is generated - # internally for administration because holding '-owner' notification - # may cause infinite loop of checking. (Actually, it is stopped - # elsewhere.) + # Don't check for spam if the message has been approved or it is generated + # internally for administration because holding '-owner' notification may + # cause infinite loop of checking. (Actually, it is stopped elsewhere.) if msgdata.get('approved') or msg.get('x-list-administrivia'): return # First do site hard coded header spam checks diff --git a/Mailman/Handlers/ToArchive.py b/Mailman/Handlers/ToArchive.py index 59bf680f..6deb0958 100644 --- a/Mailman/Handlers/ToArchive.py +++ b/Mailman/Handlers/ToArchive.py @@ -1,18 +1,19 @@ -# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2005 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 -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Add the message to the archives.""" diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py index b0f948ac..e796a874 100644 --- a/Mailman/Handlers/ToDigest.py +++ b/Mailman/Handlers/ToDigest.py @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. -"""Add the message to the list's current digest and possibly send it. -""" +"""Add the message to the list's current digest and possibly send it.""" # Messages are accumulated to a Unix mailbox compatible file containing all # the messages destined for the digest. This file must be parsable by the @@ -90,19 +90,17 @@ def process(mlist, msg, msgdata): # This is a bit of a kludge to get the mbox file moved to the digest # queue directory. try: - # Let's close in try - except here because a error in send_digest - # can stop regular delivery silently. Unsuccessful digest - # delivery should be tried again by cron and the site - # administrator will be notified of any error explicitly by the - # cron error message. + # Enclose in try/except here because a error in send_digest() can + # silently stop regular delivery. Unsuccessful digest delivery + # should be tried again by cron and the site administrator will be + # notified of any error explicitly by the cron error message. mboxfp.seek(0) send_digests(mlist, mboxfp) os.unlink(mboxfile) except Exception, errmsg: - # I know bare except is prohibited in mailman coding but we can't - # forcast what new exception can occur here. + # Bare except is generally prohibited in Mailman, but we can't + # forecast what exceptions can occur here. syslog('error', 'send_digests() failed: %s', errmsg) - pass mboxfp.close() @@ -341,7 +339,7 @@ def send_i18n_digests(mlist, mboxfp): else: # If decoded payload is empty, this may be multipart message. # -- just stringfy it. - payload = msg.get_payload(decode=True)\ + payload = msg.get_payload(decode=True) \ or msg.as_string().split('\n\n',1)[1] mcset = msg.get_content_charset('') if mcset and mcset <> lcset and mcset <> lcset_out: diff --git a/Mailman/Logging/Logger.py b/Mailman/Logging/Logger.py index 6e72843f..617347d4 100644 --- a/Mailman/Logging/Logger.py +++ b/Mailman/Logging/Logger.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """File-based logger, writes to named category files in mm_cfg.LOG_DIR.""" diff --git a/Mailman/Logging/Syslog.py b/Mailman/Logging/Syslog.py index 654ce64c..531ab1d7 100644 --- a/Mailman/Logging/Syslog.py +++ b/Mailman/Logging/Syslog.py @@ -1,24 +1,27 @@ -# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2005 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 -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Central logging class for the Mailman system. This might eventually be replaced by a syslog based logger, hence the name. """ +import quopri + from Mailman.Logging.StampedLogger import StampedLogger @@ -59,7 +62,6 @@ class _Syslog: logf.write(msg + '\n') except UnicodeError: # Python 2.4 may fail to write 8bit (non-ascii) characters - import quopri logf.write(quopri.encodestring(msg) + '\n') # For the ultimate in convenience diff --git a/Mailman/MTA/Manual.py b/Mailman/MTA/Manual.py index 7e4e4648..92e1c03c 100644 --- a/Mailman/MTA/Manual.py +++ b/Mailman/MTA/Manual.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Creation/deletion hooks for manual /etc/aliases files.""" diff --git a/Mailman/MTA/Postfix.py b/Mailman/MTA/Postfix.py index cee0eb1d..33cb9a47 100644 --- a/Mailman/MTA/Postfix.py +++ b/Mailman/MTA/Postfix.py @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2003 by the Free Software Foundation, Inc. +# Copyright (C) 2001-2005 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 @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. -"""Creation/deletion hooks for the Postfix MTA. -""" +"""Creation/deletion hooks for the Postfix MTA.""" import os import pwd diff --git a/Mailman/MailList.py b/Mailman/MailList.py index cf07c842..a8484e41 100644 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """The class representing a Mailman mailing list. @@ -1469,13 +1470,13 @@ bad regexp in bounce_matching_header line: %s """Returns matched entry in ban_list if email matches. Otherwise returns None. """ - ban = 0 + ban = False for pattern in self.ban_list: if pattern.startswith('^'): # This is a regular expression match try: if re.search(pattern, email, re.IGNORECASE): - ban = 1 + ban = True break except re.error: # BAW: we should probably remove this pattern @@ -1483,7 +1484,7 @@ bad regexp in bounce_matching_header line: %s else: # Do the comparison case insensitively if pattern.lower() == email.lower(): - ban = 1 + ban = True break if ban: return pattern diff --git a/Mailman/Message.py b/Mailman/Message.py index 600b437a..4a0d7c7c 100644 --- a/Mailman/Message.py +++ b/Mailman/Message.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Standard Mailman message object. @@ -190,7 +191,7 @@ class Message(email.Message.Message): def get_filename(self, failobj=None): """Some MUA have bugs in RFC2231 filename encoding and cause - mailman to stop delivery in Scrubber.py (called from ToDigest.py). + Mailman to stop delivery in Scrubber.py (called from ToDigest.py). """ try: filename = email.Message.Message.get_filename(self, failobj) diff --git a/Mailman/versions.py b/Mailman/versions.py index 9d19e8df..eff8ffdb 100644 --- a/Mailman/versions.py +++ b/Mailman/versions.py @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Routines which rectify an old mailing list with current structure. @@ -29,7 +30,6 @@ changes. Note that the routines have only one pass - when .CheckVersions() finds a version change it runs this routine and then updates the data_version number of the list, and then does a .Save(), so the transformations won't be run again until another version change is detected. - """ @@ -11,33 +11,33 @@ Here is a history of user visible changes to Mailman. - The fix for CAN-2005-0202 has been enhanced to issue an appropriate message instead of just quietly dropping ./ and ../ from URLs. - - A note on CVE-2005-3573: Although the RFC2231 bug example in the - CVE has been solved in mailman-2.1.6, there may be more cases - where ToDigest.send_digests() can block regular delivery. - We put the send_digests() calling part in try - except clause and - leave a message in the error log if something happened in - send_digests(). Daily call of cron/senddigests will notify more - detail to the site administrator. + - A note on CVE-2005-3573: Although the RFC2231 bug example in the CVE has + been solved in Mailman 2.1.6, there may be more cases where + ToDigest.send_digests() can block regular delivery. We put the + send_digests() calling part in a try/except clause and leave a message + in the error log if something happened in send_digests(). Daily call of + cron/senddigests will provide more detail to the site administrator. - List administrators can no longer change the user's option/subscription globally. Site admin can change these only if mm_cfg.ALLOW_SITE_ADMIN_COOKIES is set to Yes. - - Script tag is disallowd in edithtml script. + - <script> tags are HTML-escaped in the edithtml CGI script. - - Since probe message for the disabled users may reach unexpected - persons, the password was excluded from sendProbe() and probe.txt. - Note that the default value of VERP_PROBE has been set to `No' - from 2.1.6., thus this change doesn't change the default behavior. + - Since the probe message for disabled users may reach unintended + recipients, the password is excluded from sendProbe() and probe.txt. + Note that the default value of VERP_PROBE has been set to `No' from + 2.1.6., thus this change doesn't affect the default behavior. New Features - - Always remove DomainKey (and similar) headers (1287546) from messages - sent to the list. + - Always remove DomainKey (and similar) headers from messages sent to the + list. (1287546) - - List owners can customize content filter behavior as not to collapse - multipart/alternative to its first content. This allows HTML part - to pass through after other content filtering is done. + - List owners can control the content filter behavior when collapsing + multipart/alternative parts to its first subpart. This allows the + option of letting the HTML part pass through after other content + filtering is done. Internationalization @@ -45,65 +45,69 @@ Here is a history of user visible changes to Mailman. Bug fixes and other patches - - Defaults.py.in: SCRUBBER_DONT_USE_ATTACHMENT_FILENAME is set to True - for safer operation. + - Defaults.py.in: SCRUBBER_DONT_USE_ATTACHMENT_FILENAME is set to True for + safer operation. - - Fix Scrubber.py mungs quoted-printable bug with introducing - 'X-Mailman-Scrubbed' header for marking that the payload is + - Fixed the bug where Scrubber.py munges quoted-printable by introducing + the 'X-Mailman-Scrubbed' header which marks that the payload is scrubber-munged. The flag is referenced in ToDigest.py, ToArchive.py, - Decorate.py and Archiver. Similar problem in ToDigest.py where the + Decorate.py and Archiver. A similar problem in ToDigest.py where the plain digest is generated is also fixed. - - Fix Syslog.py to write quopri encoded message when it fail to write + - Fixed Syslog.py to write quopri encoded messages when it fail to write 8-bit characters. - - Fix MTA/Postfix.py to check aliases group permission in check_perms - and fix mailman-install document on this matter (1378270). + - Fixed MTA/Postfix.py to check aliases group permission in check_perms + and fixed mailman-install document on this matter (1378270). - - Fix private.py to go to the original URL after authorization (1080943). + - Fixed private.py to go to the original URL after authorization + (1080943). - - Fix bounce log score messages to be more consistent. + - Fixed bounce log score messages to be more consistent. - - Fix bin/remove_members to accept no arguments when both --fromall and + - Fixed bin/remove_members to accept no arguments when both --fromall and --file= options are specified. - - Change cgi-bin and mail wrapper "group not found" error message to be + - Changed cgi-bin and mail wrapper "group not found" error message to be more descriptive of the actual problem. - - Apply the list's ban_list to address changes and admin mass subscribe - and invite and to confirmations/approvals of address changes, - subscriptions and invitations. + - The list's ban_list now applies to address changes, admin mass + subscribes and invites, and to confirmations/approvals of address + changes, subscriptions and invitations. - - Decode quoted-printable and base64 encoded parts before passing to + - quoted-printable and base64 encoded parts are decoded before passing to HTML_TO_PLAIN_TEXT_COMMAND (1367783). - - Remove Approve: header from post - treat as Approved: (1355707). + - Approve: header is removed from posts, and treated the same as the + Approved: header. (1355707) - - Stop removing line following Approve(d): line in body of post (1318883). + - Fixed the removal of the line following Approve[d]: line in body of + post. (1318883) - - Remove Approve(d): <password> from all text/* parts in addition the - initial text/plain part. It still must be the first non-blank line in - the first text/plain part or it won't be found or removed at all - (1181161). + - The Approve[d]: <password> header is removed from all text/* parts in + addition the initial text/plain part. It must still be the first + non-blank line in the first text/plain part or it won't be found or + removed at all. (1181161) - - Log post in post log with true sender, not listname-bounces (1287921). + - Posts are now logged in post log file with the true sender, not + listname-bounces. (1287921) - Correctly initialize and remember the list's default_member_moderation - attribute in the web list creation page (1263213). + attribute in the web list creation page. (1263213) - - Add PEP263 charset in config_list output (1343100). + - PEP263 charset is added to the config_list output. (1343100) - - header_filter_rules get lost if accessed directly and needed authenti- - cation by login page (1230865). + - Fixed header_filter_rules getting lost if accessed directly and + authentication was needed by login page. (1230865) - Obscure email when the poster doesn't set full name in 'From:' header. - - Take preambles and epilogues into account when calculating message sizes - for holding purposes (Mark Sapiro). + - Preambles and epilogues are taken into account when calculating message + sizes for holding purposes. (Mark Sapiro) - - Logging/Logger.py unicode transform option (1235567). + - Logging/Logger.py unicode transform option. (1235567) - - bin/update crashes with bogus files (949117). + - bin/update crashes with bogus files. (949117) - Bugs and patches: 1212066/1301983 (Date header in create/remove notice) diff --git a/bin/config_list b/bin/config_list index 18ced8f9..25d4fb62 100644 --- a/bin/config_list +++ b/bin/config_list @@ -14,7 +14,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Configure a list from a text file description. diff --git a/bin/remove_members b/bin/remove_members index efd91ff4..a7b4ebb4 100755 --- a/bin/remove_members +++ b/bin/remove_members @@ -14,8 +14,9 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. + """Remove members from a list. Usage: @@ -56,7 +57,6 @@ Options: listname is the name of the mailing list to use. addr1 ... are additional addresses to remove. - """ import sys diff --git a/contrib/mmdsr.readme b/contrib/mmdsr.readme index fa074704..d7aa2543 100644 --- a/contrib/mmdsr.readme +++ b/contrib/mmdsr.readme @@ -1,33 +1,35 @@ Daily Status Report script... -The mmdsr script was created by Brad Knowles to produce a daily status report for mailman. It was initially posted at <http://sourceforge.net/tracker/index.php?func=detail&aid=1123383&group_id=103&atid=300103> which see for possible patches and other enhancements. - -It is intended that there will be a 'cleaner', more complete readme file in the future. In the interim, here are Brad's original comments. - -I quickly whacked together a Daily Status Report script for -Mailman (using Bourne shell, not Python ;), and thought that other -folks might be interested in seeing it. - -The basic concept is a program that gets fired off at 23:59 every -night, and goes through a variety of log files looking for entries -specific to that date, and indicating problems or certain types of -activity that might be of interest to someone trying to administer -the server. It also does an "ls -la" of /usr/local/mailman/qfiles/*, -so that you can see what is in the queue at the time of the running -of the script. - -My concept was that this daily report would get e-mailed to the -admin, or posted to a "reports" mailing list, where they could be -archived and kept for future reference. - -The script does not (yet) do any statistics calculations, although it -should be relatively easy to hack together some basic stats using -awk, sort, etc.... - -Anyway, I thought I'd share it and let folks take a look at it, and if -anyone has any recommended improvements, we can incorporate -those and share them back out with everyone. - -The code is written under a BSD-style license, so if you don't want -to contribute any changes back to me, that's okay. Of course, I -would prefer that you did, but I leave the choice up to you. +The mmdsr script was created by Brad Knowles to produce a daily status report +for mailman. It was initially posted at +<http://sourceforge.net/tracker/index.php?func=detail&aid=1123383&group_id=103&atid=300103> +which see for possible patches and other enhancements. + +It is intended that there will be a 'cleaner', more complete readme file in +the future. In the interim, here are Brad's original comments. + +I quickly whacked together a Daily Status Report script for Mailman (using +Bourne shell, not Python ;), and thought that other folks might be interested +in seeing it. + +The basic concept is a program that gets fired off at 23:59 every night, and +goes through a variety of log files looking for entries specific to that date, +and indicating problems or certain types of activity that might be of interest +to someone trying to administer the server. It also does an "ls -la" of +/usr/local/mailman/qfiles/*, so that you can see what is in the queue at the +time of the running of the script. + +My concept was that this daily report would get e-mailed to the admin, or +posted to a "reports" mailing list, where they could be archived and kept for +future reference. + +The script does not (yet) do any statistics calculations, although it should +be relatively easy to hack together some basic stats using awk, sort, etc.... + +Anyway, I thought I'd share it and let folks take a look at it, and if anyone +has any recommended improvements, we can incorporate those and share them back +out with everyone. + +The code is written under a BSD-style license, so if you don't want to +contribute any changes back to me, that's okay. Of course, I would prefer that +you did, but I leave the choice up to you. diff --git a/misc/paths.py.in b/misc/paths.py.in index b80648b6..c58492f5 100644 --- a/misc/paths.py.in +++ b/misc/paths.py.in @@ -14,7 +14,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. # This file becomes paths.py which is installed in may directories. By # importing this module, sys.path gets `hacked' so that the $prefix/Mailman diff --git a/src/common.c b/src/common.c index 0b135758..e46a2b09 100644 --- a/src/common.c +++ b/src/common.c @@ -1,6 +1,6 @@ /* common.c --- Common routines, constants, etc. Used by all the wrappers. * - * Copyright (C) 1998,1999,2000,2001,2002,2005 by the Free Software Foundation, Inc. + * Copyright (C) 1998-2005 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 @@ -14,7 +14,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #include "common.h" @@ -63,8 +64,8 @@ fatal(const char* ident, int exitcode, char* format, ...) { #ifndef HAVE_VSNPRINTF /* A replacement is provided in vsnprintf.c for ancient systems still - * lacking one in their C library. - */ + * lacking one in their C library. + */ int vsnprintf(char*, size_t, const char*, va_list); #endif /* !HAVE_VSNPRINTF */ @@ -99,8 +100,8 @@ fatal(const char* ident, int exitcode, char* format, ...) printf("<title>Mailman CGI error!!!</title>\n"); printf("</head><body>\n"); printf("<h1>Mailman CGI error!!!</h1>\n"); - printf("The Mailman CGI wrapper encountered a fatal error. "); - printf("This entry is being stored in your syslog:"); + printf("The Mailman CGI wrapper encountered a fatal error. "); + printf("This entry is being stored in your syslog:"); printf("\n<pre>\n"); printf(log_entry); printf("</pre>\n"); @@ -119,44 +120,44 @@ void check_caller(const char* ident, const char* parentgroup) { GID_T mygid = getgid(); - struct group *mygroup = getgrgid(mygid); - char* option; - char* server; - char* wrapper; - - if (running_as_cgi) { - option = "--with-cgi-gid"; - server = "web"; - wrapper = "CGI"; - } - else { - option = "--with-mail-gid"; - server = "mail"; - wrapper = "mail"; - } - - if (!mygroup) - fatal(ident, GROUP_NAME_NOT_FOUND, - "Failure to find group name for GID %d. Mailman\n" - "expected the %s wrapper to be executed as group\n" - "\"%s\", but the system's %s server executed the\n" - "wrapper as GID %d for which the name could not be\n" - "found. Try adding GID %d to your system as \"%s\",\n" - "or tweak your %s server to run the wrapper as group\n" - "\"%s\".", - mygid, wrapper, parentgroup, server, mygid, mygid, - parentgroup, server, parentgroup); + struct group *mygroup = getgrgid(mygid); + char* option; + char* server; + char* wrapper; + + if (running_as_cgi) { + option = "--with-cgi-gid"; + server = "web"; + wrapper = "CGI"; + } + else { + option = "--with-mail-gid"; + server = "mail"; + wrapper = "mail"; + } + + if (!mygroup) + fatal(ident, GROUP_NAME_NOT_FOUND, + "Failure to find group name for GID %d. Mailman\n" + "expected the %s wrapper to be executed as group\n" + "\"%s\", but the system's %s server executed the\n" + "wrapper as GID %d for which the name could not be\n" + "found. Try adding GID %d to your system as \"%s\",\n" + "or tweak your %s server to run the wrapper as group\n" + "\"%s\".", + mygid, wrapper, parentgroup, server, mygid, mygid, + parentgroup, server, parentgroup); if (strcmp(parentgroup, mygroup->gr_name)) fatal(ident, GROUP_MISMATCH, - "Group mismatch error. Mailman expected the %s\n" - "wrapper script to be executed as group \"%s\", but\n" - "the system's %s server executed the %s script as\n" - "group \"%s\". Try tweaking the %s server to run the\n" - "script as group \"%s\", or re-run configure, \n" - "providing the command line option `%s=%s'.", - wrapper, parentgroup, server, wrapper, mygroup->gr_name, - server, parentgroup, option, mygroup->gr_name); + "Group mismatch error. Mailman expected the %s\n" + "wrapper script to be executed as group \"%s\", but\n" + "the system's %s server executed the %s script as\n" + "group \"%s\". Try tweaking the %s server to run the\n" + "script as group \"%s\", or re-run configure, \n" + "providing the command line option `%s=%s'.", + wrapper, parentgroup, server, wrapper, mygroup->gr_name, + server, parentgroup, option, mygroup->gr_name); } @@ -300,5 +301,6 @@ run_script(const char* script, int argc, char** argv, char** env) /* * Local Variables: * c-file-style: "python" + * indent-tabs-mode: nil * End: */ |