summaryrefslogtreecommitdiff
path: root/src/mailman/handlers/docs
diff options
context:
space:
mode:
authorBarry Warsaw2015-06-02 13:51:58 +0000
committerBarry Warsaw2015-06-02 10:09:24 -0400
commite57787d8f6ff0cc8b1e30f2531a56eaf9a28511a (patch)
tree8deb9773fe8e3871b5859a866a70019d92a9a3cb /src/mailman/handlers/docs
parentf0f13923af208d2eab97b6b304b77e9d5a55cc5a (diff)
downloadmailman-e57787d8f6ff0cc8b1e30f2531a56eaf9a28511a.tar.gz
mailman-e57787d8f6ff0cc8b1e30f2531a56eaf9a28511a.tar.zst
mailman-e57787d8f6ff0cc8b1e30f2531a56eaf9a28511a.zip
Diffstat (limited to 'src/mailman/handlers/docs')
-rw-r--r--src/mailman/handlers/docs/filtering.rst27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/mailman/handlers/docs/filtering.rst b/src/mailman/handlers/docs/filtering.rst
index 582211d54..427db4273 100644
--- a/src/mailman/handlers/docs/filtering.rst
+++ b/src/mailman/handlers/docs/filtering.rst
@@ -208,7 +208,7 @@ Clean up.
Conversion to plain text
========================
-Many mailing lists prohibit HTML email, and in fact, such email can be a
+Some mailing lists prohibit HTML email, and in fact, such email can be a
phishing or spam vector. However, many mail readers will send HTML email by
default because users think it looks pretty. One approach to handling this
would be to filter out ``text/html`` parts and rely on
@@ -228,20 +228,8 @@ By default, Mailman sends the message through lynx, but since this program is
not guaranteed to exist, we'll craft a simple, but stupid script to simulate
the conversion process. The script expects a single argument, which is the
name of the file containing the message payload to filter.
+::
- >>> import os, sys
- >>> script_path = os.path.join(config.DATA_DIR, 'filter.py')
- >>> fp = open(script_path, 'w')
- >>> try:
- ... print("""\
- ... import sys
- ... print('Converted text/html to text/plain')
- ... print('Filename:', sys.argv[1])
- ... """, file=fp)
- ... finally:
- ... fp.close()
- >>> config.HTML_TO_PLAIN_TEXT_COMMAND = '%s %s %%(filename)s' % (
- ... sys.executable, script_path)
>>> msg = message_from_string("""\
... From: aperson@example.com
... Content-Type: text/html
@@ -250,7 +238,10 @@ name of the file containing the message payload to filter.
... <html><head></head>
... <body></body></html>
... """)
- >>> process(mlist, msg, {})
+
+ >>> from mailman.handlers.tests.test_mimedel import dummy_script
+ >>> with dummy_script():
+ ... process(mlist, msg, {})
>>> print(msg.as_string())
From: aperson@example.com
MIME-Version: 1.0
@@ -269,6 +260,7 @@ Similarly, if after filtering a multipart section ends up empty, then the
entire multipart is discarded. For example, here's a message where an inner
``multipart/mixed`` contains two jpeg subparts. Both jpegs are filtered out,
so the entire inner ``multipart/mixed`` is discarded.
+::
>>> msg = message_from_string("""\
... From: aperson@example.com
@@ -309,7 +301,10 @@ so the entire inner ``multipart/mixed`` is discarded.
... aaa
... --AAA--
... """)
- >>> process(mlist, msg, {})
+
+ >>> with dummy_script():
+ ... process(mlist, msg, {})
+
>>> print(msg.as_string())
From: aperson@example.com
Content-Type: multipart/mixed; boundary=AAA