aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Mailman/Defaults.py.in3
-rw-r--r--Mailman/Gui/ContentFilter.py12
-rw-r--r--Mailman/Handlers/MimeDel.py10
-rw-r--r--Mailman/MailList.py1
-rw-r--r--Mailman/Version.py2
-rw-r--r--Mailman/versions.py4
6 files changed, 25 insertions, 7 deletions
diff --git a/Mailman/Defaults.py.in b/Mailman/Defaults.py.in
index dd73fc4e..f1c09b81 100644
--- a/Mailman/Defaults.py.in
+++ b/Mailman/Defaults.py.in
@@ -985,6 +985,9 @@ DEFAULT_FILTER_FILENAME_EXTENSIONS = [
# passed through. Format is the same as DEFAULT_FILTER_FILENAME_EXTENSIONS.
DEFAULT_PASS_FILENAME_EXTENSIONS = []
+# Replace multipart/alternative with its first alternative.
+DEFAULT_COLLAPSE_ALTERNATIVES = Yes
+
# Whether text/html should be converted to text/plain after content filtering
# is performed. Conversion is done according to HTML_TO_PLAIN_TEXT_COMMAND
DEFAULT_CONVERT_HTML_TO_PLAINTEXT = Yes
diff --git a/Mailman/Gui/ContentFilter.py b/Mailman/Gui/ContentFilter.py
index d681d6df..401ecf9f 100644
--- a/Mailman/Gui/ContentFilter.py
+++ b/Mailman/Gui/ContentFilter.py
@@ -57,9 +57,13 @@ class ContentFilter(GUIBase):
<p>After this initial filtering, any <tt>multipart</tt>
attachments that are empty are removed. If the outer message is
left empty after this filtering, then the whole message is
- discarded. Then, each <tt>multipart/alternative</tt> section will
+ discarded.
+
+ <p> Then, each <tt>multipart/alternative</tt> section will
be replaced by just the first alternative that is non-empty after
- filtering.
+ filtering if
+ <a href="?VARHELP=contentfilter/collapse_alternatives"
+ >collapse_alternatives</a> is enabled.
<p>Finally, any <tt>text/html</tt> parts that are left in the
message may be converted to <tt>text/plain</tt> if
@@ -109,6 +113,10 @@ class ContentFilter(GUIBase):
filename extension. Leave this field blank to skip this filter
test."""),),
+ ('collapse_alternatives', mm_cfg.Radio, (_('No'), _('Yes')), 0,
+ _("""Should Mailman collapse multipart/alternative to its
+ first part content?""")),
+
('convert_html_to_plaintext', mm_cfg.Radio, (_('No'), _('Yes')), 0,
_("""Should Mailman convert <tt>text/html</tt> parts to plain
text? This conversion happens after MIME attachments have been
diff --git a/Mailman/Handlers/MimeDel.py b/Mailman/Handlers/MimeDel.py
index 79efa620..3afdce95 100644
--- a/Mailman/Handlers/MimeDel.py
+++ b/Mailman/Handlers/MimeDel.py
@@ -90,10 +90,12 @@ 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?).
- collapse_multipart_alternatives(msg)
- if ctype == 'multipart/alternative':
- firstalt = msg.get_payload(0)
- reset_payload(msg, firstalt)
+ # TK: Make this configurable from Gui/ContentFilter.py.
+ if mlist.collapse_alternatives:
+ collapse_multipart_alternatives(msg)
+ if ctype == 'multipart/alternative':
+ firstalt = msg.get_payload(0)
+ reset_payload(msg, firstalt)
# If we removed some parts, make note of this
changedp = 0
if numparts <> len([subpart for subpart in msg.walk()]):
diff --git a/Mailman/MailList.py b/Mailman/MailList.py
index 8146f2a4..b369769f 100644
--- a/Mailman/MailList.py
+++ b/Mailman/MailList.py
@@ -363,6 +363,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
mm_cfg.DEFAULT_FILTER_FILENAME_EXTENSIONS
self.pass_filename_extensions = mm_cfg.DEFAULT_PASS_FILENAME_EXTENSIONS
self.filter_content = mm_cfg.DEFAULT_FILTER_CONTENT
+ self.collapse_alternatives = mm_cfg.DEFAULT_COLLAPSE_ALTERNATIVES
self.convert_html_to_plaintext = \
mm_cfg.DEFAULT_CONVERT_HTML_TO_PLAINTEXT
self.filter_action = mm_cfg.DEFAULT_FILTER_ACTION
diff --git a/Mailman/Version.py b/Mailman/Version.py
index d8d69edc..2e123f25 100644
--- a/Mailman/Version.py
+++ b/Mailman/Version.py
@@ -36,7 +36,7 @@ HEX_VERSION = ((MAJOR_REV << 24) | (MINOR_REV << 16) | (MICRO_REV << 8) |
(REL_LEVEL << 4) | (REL_SERIAL << 0))
# config.pck schema version number
-DATA_FILE_VERSION = 95
+DATA_FILE_VERSION = 96
# qfile/*.db schema version number
QFILE_SCHEMA_VERSION = 3
diff --git a/Mailman/versions.py b/Mailman/versions.py
index c7710b18..084a548f 100644
--- a/Mailman/versions.py
+++ b/Mailman/versions.py
@@ -403,6 +403,10 @@ def NewVars(l):
# automatic discard
add_only_if_missing('max_days_to_hold', 0)
add_only_if_missing('nonmember_rejection_notice', '')
+ # multipart/alternative collapse
+ add_only_if_missing('collapse_alternatives',
+ mm_cfg.DEFAULT_COLLAPSE_ALTERNATIVES)
+