summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Mailman/Message.py3
-rw-r--r--Mailman/docs/calc-recips.txt22
-rw-r--r--Mailman/docs/cleanse.txt8
-rw-r--r--Mailman/docs/cook-headers.txt52
4 files changed, 43 insertions, 42 deletions
diff --git a/Mailman/Message.py b/Mailman/Message.py
index 1ce654ba4..f0f95e76e 100644
--- a/Mailman/Message.py
+++ b/Mailman/Message.py
@@ -53,7 +53,8 @@ class Message(email.message.Message):
def get_all(self, name, failobj=None):
all_values = email.message.Message.get_all(self, name, failobj)
- return [unicode(value, 'ascii') for value in all_values]
+ return [(unicode(value, 'ascii') if isinstance(value, str) else value)
+ for value in all_values]
# BAW: For debugging w/ bin/dumpdb. Apparently pprint uses repr.
def __repr__(self):
diff --git a/Mailman/docs/calc-recips.txt b/Mailman/docs/calc-recips.txt
index 6fe09fa81..c36841d1c 100644
--- a/Mailman/docs/calc-recips.txt
+++ b/Mailman/docs/calc-recips.txt
@@ -7,18 +7,18 @@ modules and depends on a host of factors.
>>> from Mailman.Handlers.CalcRecips import process
>>> from Mailman.configuration import config
- >>> mlist = config.db.list_manager.create('_xtest@example.com')
+ >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
Recipients are calculate from the list members, so add a bunch of members to
start out with. First, create a bunch of addresses...
>>> usermgr = config.db.user_manager
- >>> address_a = usermgr.create_address('aperson@example.com')
- >>> address_b = usermgr.create_address('bperson@example.com')
- >>> address_c = usermgr.create_address('cperson@example.com')
- >>> address_d = usermgr.create_address('dperson@example.com')
- >>> address_e = usermgr.create_address('eperson@example.com')
- >>> address_f = usermgr.create_address('fperson@example.com')
+ >>> address_a = usermgr.create_address(u'aperson@example.com')
+ >>> address_b = usermgr.create_address(u'bperson@example.com')
+ >>> address_c = usermgr.create_address(u'cperson@example.com')
+ >>> address_d = usermgr.create_address(u'dperson@example.com')
+ >>> address_e = usermgr.create_address(u'eperson@example.com')
+ >>> address_f = usermgr.create_address(u'fperson@example.com')
...then subscribe these addresses to the mailing list as members...
@@ -50,11 +50,11 @@ but not all of the recipients.
...
... Something of great import.
... """)
- >>> recips = set(('qperson@example.com', 'zperson@example.com'))
+ >>> recips = set((u'qperson@example.com', u'zperson@example.com'))
>>> msgdata = dict(recips=recips)
>>> process(mlist, msg, msgdata)
>>> sorted(msgdata['recips'])
- ['qperson@example.com', 'zperson@example.com']
+ [u'qperson@example.com', u'zperson@example.com']
Regular delivery recipients
@@ -66,7 +66,7 @@ soon as they are posted. In other words, these folks are not digest members.
>>> msgdata = {}
>>> process(mlist, msg, msgdata)
>>> sorted(msgdata['recips'])
- ['aperson@example.com', 'bperson@example.com', 'cperson@example.com']
+ [u'aperson@example.com', u'bperson@example.com', u'cperson@example.com']
Members can elect not to receive a list copy of their own postings.
@@ -79,7 +79,7 @@ Members can elect not to receive a list copy of their own postings.
>>> msgdata = {}
>>> process(mlist, msg, msgdata)
>>> sorted(msgdata['recips'])
- ['aperson@example.com', 'bperson@example.com']
+ [u'aperson@example.com', u'bperson@example.com']
Members can also elect not to receive a list copy of any message on which they
are explicitly named as a recipient. However, see the AvoidDuplicates handler
diff --git a/Mailman/docs/cleanse.txt b/Mailman/docs/cleanse.txt
index ecf452788..2e40e6df5 100644
--- a/Mailman/docs/cleanse.txt
+++ b/Mailman/docs/cleanse.txt
@@ -7,7 +7,7 @@ headers can be used to fish for membership.
>>> from Mailman.Handlers.Cleanse import process
>>> from Mailman.configuration import config
- >>> mlist = config.db.list_manager.create('_xtest@example.com')
+ >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
Headers such as Approved, Approve, and Urgent are used to grant special
pemissions to individual messages. All may contain a password; the first two
@@ -16,7 +16,7 @@ for approval. The latter header is used to send a regular message to all
members, regardless of whether they get digests or not. Because all three
headers contain passwords, they must be removed from any posted message.
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
... Approved: foobar
... Approve: barfoo
@@ -39,7 +39,7 @@ headers supported by some mail readers. For example, X-PMRC is supported by
Pegasus mail. I don't remember what program uses X-Confirm-Reading-To though
(Some Microsoft product perhaps?).
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: bperson@example.com
... Reply-To: bperson@example.org
... Sender: asystem@example.net
@@ -76,7 +76,7 @@ Hotmail apparently sets X-Originating-Email.
>>> mlist.anonymous_list = True
>>> mlist.description = u'A Test Mailing List'
>>> mlist.preferred_language = u'en'
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: bperson@example.com
... Reply-To: bperson@example.org
... Sender: asystem@example.net
diff --git a/Mailman/docs/cook-headers.txt b/Mailman/docs/cook-headers.txt
index a49519b13..1b7705d1c 100644
--- a/Mailman/docs/cook-headers.txt
+++ b/Mailman/docs/cook-headers.txt
@@ -9,13 +9,13 @@ is getting sent through the system. We'll take things one-by-one.
>>> from Mailman.Handlers.CookHeaders import process
>>> from Mailman.configuration import config
- >>> mlist = config.db.list_manager.create('_xtest@example.com')
+ >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
>>> mlist.subject_prefix = u''
>>> mlist.include_list_post_header = False
>>> mlist.archive = True
>>> # XXX This will almost certainly change once we've worked out the web
>>> # space layout for mailing lists now.
- >>> mlist.web_page_url = 'http://lists.example.com/'
+ >>> mlist.web_page_url = u'http://lists.example.com/'
Saving the original sender
@@ -24,7 +24,7 @@ Saving the original sender
Because the original sender headers may get deleted or changed, CookHeaders
will place the sender in the message metadata for safe keeping.
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
...
... A message of great import.
@@ -32,11 +32,11 @@ will place the sender in the message metadata for safe keeping.
>>> msgdata = {}
>>> process(mlist, msg, msgdata)
>>> msgdata['original_sender']
- 'aperson@example.com'
+ u'aperson@example.com'
But if there was no original sender, then the empty string will be saved.
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... Subject: No original sender
...
... A message of great import.
@@ -54,19 +54,19 @@ The X-BeenThere header is what Mailman uses to recognize messages that have
already been processed by this mailing list. It's one small measure against
mail loops.
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
...
... A message of great import.
... """)
>>> process(mlist, msg, {})
>>> msg['x-beenthere']
- '_xtest@example.com'
+ u'_xtest@example.com'
Mailman appends X-BeenThere headers, so if there already is one in the
original message, the posted message will contain two such headers.
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
... X-BeenThere: another@example.com
...
@@ -74,7 +74,7 @@ original message, the posted message will contain two such headers.
... """)
>>> process(mlist, msg, {})
>>> sorted(msg.get_all('x-beenthere'))
- ['_xtest@example.com', 'another@example.com']
+ [u'_xtest@example.com', u'another@example.com']
Mailman version header
@@ -82,7 +82,7 @@ Mailman version header
Mailman will also insert an X-Mailman-Version header...
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
...
... A message of great import.
@@ -94,7 +94,7 @@ Mailman will also insert an X-Mailman-Version header...
...but only if one doesn't already exist.
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
... X-Mailman-Version: 3000
...
@@ -103,7 +103,7 @@ Mailman will also insert an X-Mailman-Version header...
>>> process(mlist, msg, {})
>>> from Mailman.Version import VERSION
>>> msg['x-mailman-version']
- '3000'
+ u'3000'
Precedence header
@@ -113,7 +113,7 @@ Mailman will insert a Precedence header, which is a de-facto standard for
telling automatic reply software (e.g. vacation(1)) not to respond to this
message.
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
...
... A message of great import.
@@ -121,12 +121,12 @@ message.
>>> process(mlist, msg, {})
>>> from Mailman.Version import VERSION
>>> msg['precedence']
- 'list'
+ u'list'
But Mailman will only add that header if the original message doesn't already
have one of them.
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
... Precedence: junk
...
@@ -135,7 +135,7 @@ have one of them.
>>> process(mlist, msg, {})
>>> from Mailman.Version import VERSION
>>> msg['precedence']
- 'junk'
+ u'junk'
RFC 2919 and 2369 headers
@@ -160,7 +160,7 @@ These RFCs define headers for mailing list actions. A mailing list should
generally add these headers, but not for messages that aren't crafted for a
specific list (e.g. password reminders in Mailman 2.x).
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
...
... """)
@@ -173,7 +173,7 @@ Some people don't like these headers because their mail readers aren't good
about hiding them. A list owner can turn these headers off.
>>> mlist.include_rfc2369_headers = False
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
...
... """)
@@ -186,8 +186,8 @@ But normally, a list will include these headers.
>>> mlist.include_rfc2369_headers = True
>>> mlist.include_list_post_header = True
- >>> mlist.preferred_language = 'en'
- >>> msg = message_from_string("""\
+ >>> mlist.preferred_language = u'en'
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
...
... """)
@@ -207,8 +207,8 @@ But normally, a list will include these headers.
If the mailing list has a description, then it is included in the List-Id
header.
- >>> mlist.description = 'My test mailing list'
- >>> msg = message_from_string("""\
+ >>> mlist.description = u'My test mailing list'
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
...
... """)
@@ -227,7 +227,7 @@ header.
Administrative messages crafted by Mailman will have a reduced set of headers.
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
...
... """)
@@ -247,7 +247,7 @@ With the normal set of List-* headers, it's still possible to suppress the
List-Post header, which is reasonable for an announce only mailing list.
>>> mlist.include_list_post_header = False
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
...
... """)
@@ -268,7 +268,7 @@ List-Archive header either.
>>> mlist.include_list_post_header = True
>>> mlist.archive = False
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
...
... """)
@@ -296,7 +296,7 @@ the recipient headers so that users will be able to reply back to the list.
>>> from Mailman.interfaces import Personalization, ReplyToMunging
>>> mlist.personalize = Personalization.full
>>> mlist.reply_goes_to_list = ReplyToMunging.no_munging
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
...
... """)