summaryrefslogtreecommitdiff
path: root/Mailman/docs/scrubber.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Mailman/docs/scrubber.txt')
-rw-r--r--Mailman/docs/scrubber.txt30
1 files changed, 13 insertions, 17 deletions
diff --git a/Mailman/docs/scrubber.txt b/Mailman/docs/scrubber.txt
index 0c8c4d94f..e4259361d 100644
--- a/Mailman/docs/scrubber.txt
+++ b/Mailman/docs/scrubber.txt
@@ -7,13 +7,9 @@ scrub attachments from messages so that binary goop doesn't end up in an
archive message.
>>> from Mailman.Handlers.Scrubber import process, save_attachment
- >>> from Mailman.Message import Message
>>> from Mailman.configuration import config
- >>> from Mailman.database import flush
- >>> from email import message_from_string
- >>> mlist = config.db.list_manager.create('_xtest@example.com')
- >>> mlist.preferred_language = 'en'
- >>> flush()
+ >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
+ >>> mlist.preferred_language = u'en'
Helper functions for getting the attachment data.
@@ -56,15 +52,15 @@ enabled, the filename will be used when this header attribute is present (yes,
this is an unfortunate double negative).
>>> config.SCRUBBER_DONT_USE_ATTACHMENT_FILENAME = False
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... Content-Type: image/gif; name="xtest.gif"
... Content-Transfer-Encoding: base64
... Content-Disposition: attachment; filename="xtest.gif"
...
... R0lGODdhAQABAIAAAAAAAAAAACwAAAAAAQABAAACAQUAOw==
- ... """, Message)
+ ... """)
>>> save_attachment(mlist, msg, '')
- '<http://www.example.com/pipermail/_xtest@example.com//xtest.gif>'
+ u'<http://www.example.com/pipermail/_xtest@example.com//xtest.gif>'
>>> data = read_attachment('xtest.gif')
>>> data[:6]
'GIF87a'
@@ -85,19 +81,19 @@ Content-Disposition: filename. This is the default for reasons described in
the Defaults.py.in file.
>>> config.SCRUBBER_DONT_USE_ATTACHMENT_FILENAME = True
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... Content-Type: image/gif; name="xtest.gif"
... Content-Transfer-Encoding: base64
... Content-Disposition: attachment; filename="xtest.gif"
...
... R0lGODdhAQABAIAAAAAAAAAAACwAAAAAAQABAAACAQUAOw==
- ... """, Message)
+ ... """)
>>> save_attachment(mlist, msg, '')
- '<http://www.example.com/pipermail/_xtest@example.com/.../attachment.gif>'
+ u'<http://www.example.com/pipermail/_xtest@example.com/.../attachment.gif>'
>>> data = read_attachment('xtest.gif')
Traceback (most recent call last):
IOError: [Errno ...] No such file or directory:
- '.../archives/private/_xtest@example.com/xtest.gif'
+ u'.../archives/private/_xtest@example.com/xtest.gif'
>>> data = read_attachment('attachment.gif')
>>> data[:6]
'GIF87a'
@@ -111,7 +107,7 @@ Scrubbing image attachments
When scrubbing image attachments, the original message is modified to include
a reference to the attachment file as available through the on-line archive.
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... MIME-Version: 1.0
... Content-Type: multipart/mixed; boundary="BOUNDARY"
...
@@ -126,7 +122,7 @@ a reference to the attachment file as available through the on-line archive.
...
... R0lGODdhAQABAIAAAAAAAAAAACwAAAAAAQABAAACAQUAOw==
... --BOUNDARY--
- ... """, Message)
+ ... """)
>>> msgdata = {}
The Scrubber.process() function is different than other handler process
@@ -186,7 +182,7 @@ Scrubbing text attachments
Similar to image attachments, text attachments will also be scrubbed, but the
placeholder will be slightly different.
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... MIME-Version: 1.0
... Content-Type: multipart/mixed; boundary="BOUNDARY"
...
@@ -200,7 +196,7 @@ placeholder will be slightly different.
...
... This is a text attachment.
... --BOUNDARY--
- ... """, Message)
+ ... """)
>>> scrubbed_msg = process(mlist, msg, {})
>>> print scrubbed_msg.as_string()
MIME-Version: 1.0