From d44c2c9f011075a7f6b6ffebe22ec3f17dda3a26 Mon Sep 17 00:00:00 2001
From: bwarsaw <>
Date: Fri, 30 Dec 2005 18:50:08 +0000
Subject: 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.
---
Mailman/Archiver/HyperArch.py | 3 +-
Mailman/Cgi/admin.py | 3 +-
Mailman/Cgi/admindb.py | 11 +++--
Mailman/Cgi/confirm.py | 5 +-
Mailman/Cgi/create.py | 3 +-
Mailman/Cgi/edithtml.py | 3 +-
Mailman/Cgi/private.py | 22 ++++-----
Mailman/Commands/cmd_confirm.py | 3 +-
Mailman/Defaults.py.in | 8 ++--
Mailman/Deliverer.py | 3 +-
Mailman/Gui/ContentFilter.py | 6 +--
Mailman/Gui/Privacy.py | 6 +--
Mailman/Handlers/Approve.py | 35 +++++++-------
Mailman/Handlers/Cleanse.py | 3 +-
Mailman/Handlers/CookHeaders.py | 24 +++++-----
Mailman/Handlers/Decorate.py | 3 +-
Mailman/Handlers/MimeDel.py | 4 +-
Mailman/Handlers/SMTPDirect.py | 13 +++---
Mailman/Handlers/Scrubber.py | 11 +++--
Mailman/Handlers/SpamDetect.py | 14 +++---
Mailman/Handlers/ToArchive.py | 11 +++--
Mailman/Handlers/ToDigest.py | 22 ++++-----
Mailman/Logging/Logger.py | 3 +-
Mailman/Logging/Syslog.py | 14 +++---
Mailman/MTA/Manual.py | 3 +-
Mailman/MTA/Postfix.py | 8 ++--
Mailman/MailList.py | 9 ++--
Mailman/Message.py | 5 +-
Mailman/versions.py | 4 +-
NEWS | 100 +++++++++++++++++++++-------------------
bin/config_list | 3 +-
bin/remove_members | 6 +--
contrib/mmdsr.readme | 64 ++++++++++++-------------
misc/paths.py.in | 3 +-
src/common.c | 84 +++++++++++++++++----------------
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):
list information page.""")])
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
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.
-
"""
diff --git a/NEWS b/NEWS
index 2528dd76..b751a00c 100644
--- a/NEWS
+++ b/NEWS
@@ -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.
+ -