summaryrefslogtreecommitdiff
path: root/Mailman/docs
diff options
context:
space:
mode:
authorBarry Warsaw2007-11-10 13:14:51 -0500
committerBarry Warsaw2007-11-10 13:14:51 -0500
commit58b8ca1c929c5bc0ea1b36fb5e6e683a8830e963 (patch)
tree4d87cdececa390c0bcc1460f60c6102e0e81f87d /Mailman/docs
parent3d7b9702e4ff97f86025f8d7ae9b29220f5bf264 (diff)
downloadmailman-58b8ca1c929c5bc0ea1b36fb5e6e683a8830e963.tar.gz
mailman-58b8ca1c929c5bc0ea1b36fb5e6e683a8830e963.tar.zst
mailman-58b8ca1c929c5bc0ea1b36fb5e6e683a8830e963.zip
All the simple test fixes are now in, and while there are still some failing
tests, we're making very good progress. Just the tough ones are left. This change did modify the the schema a bit, for better naming and typing. E.g. 'type' -> 'request_type' and using a RawStr for a hash type.
Diffstat (limited to 'Mailman/docs')
-rw-r--r--Mailman/docs/hold.txt11
-rw-r--r--Mailman/docs/lifecycle.txt8
-rw-r--r--Mailman/docs/listmanager.txt26
-rw-r--r--Mailman/docs/message.txt2
-rw-r--r--Mailman/docs/messagestore.txt2
-rw-r--r--Mailman/docs/nntp.txt12
-rw-r--r--Mailman/docs/outgoing.txt19
-rw-r--r--Mailman/docs/requests.txt13
-rw-r--r--Mailman/docs/runner.txt3
-rw-r--r--Mailman/docs/switchboard.txt8
10 files changed, 55 insertions, 49 deletions
diff --git a/Mailman/docs/hold.txt b/Mailman/docs/hold.txt
index 9dae760d8..33c542d31 100644
--- a/Mailman/docs/hold.txt
+++ b/Mailman/docs/hold.txt
@@ -10,12 +10,12 @@ are held when they meet any of a number of criteria.
>>> from Mailman.Handlers.Hold import process
>>> from Mailman.queue import Switchboard
>>> from Mailman.configuration import config
- >>> mlist = config.db.list_manager.create('_xtest@example.com')
- >>> mlist.preferred_language = 'en'
- >>> mlist.real_name = '_XTest'
+ >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
+ >>> mlist.preferred_language = u'en'
+ >>> mlist.real_name = u'_XTest'
>>> # 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/'
Here's a helper function used when we don't care about what's in the virgin
queue or in the pending database.
@@ -41,7 +41,6 @@ Short circuiting
If the message metadata indicates that the message is pre-approved, then the
handler returns immediately.
- >>> from email import message_from_string
>>> msg = message_from_string("""\
... From: aperson@example.com
...
@@ -109,7 +108,7 @@ Mailman will hold messages that have implicit destination, meaning that the
mailing list's posting address isn't included in the explicit recipients.
>>> mlist.require_explicit_destination = True
- >>> mlist.acceptable_aliases = ''
+ >>> mlist.acceptable_aliases = u''
>>> msg = message_from_string("""\
... From: aperson@example.org
... Subject: An implicit message
diff --git a/Mailman/docs/lifecycle.txt b/Mailman/docs/lifecycle.txt
index 1a3dfa2bf..ba9c83ef7 100644
--- a/Mailman/docs/lifecycle.txt
+++ b/Mailman/docs/lifecycle.txt
@@ -127,12 +127,12 @@ artifacts.
>>> from Mailman import Utils
>>> from Mailman.app.lifecycle import remove_list
>>> remove_list(mlist_2.fqdn_listname, mlist_2, True)
- >>> Utils.list_exists('test_2@example.com')
+ >>> Utils.list_exists(u'test_2@example.com')
False
We should now be able to completely recreate the mailing list.
- >>> mlist_2a = create_list('test_2@example.com', owners)
+ >>> mlist_2a = create_list(u'test_2@example.com', owners)
>>> sorted(addr.address for addr in mlist_2a.owners.addresses)
- ['aperson@example.com', 'bperson@example.com',
- 'cperson@example.com', 'dperson@example.com']
+ [u'aperson@example.com', u'bperson@example.com',
+ u'cperson@example.com', u'dperson@example.com']
diff --git a/Mailman/docs/listmanager.txt b/Mailman/docs/listmanager.txt
index 220be05e6..832100aca 100644
--- a/Mailman/docs/listmanager.txt
+++ b/Mailman/docs/listmanager.txt
@@ -19,7 +19,7 @@ Creating a mailing list
Creating the list returns the newly created IMailList object.
>>> from Mailman.interfaces import IMailingList
- >>> mlist = listmgr.create('_xtest@example.com')
+ >>> mlist = listmgr.create(u'_xtest@example.com')
>>> IMailingList.providedBy(mlist)
True
@@ -28,16 +28,16 @@ qualified listname. This latter is what uniquely distinguishes the mailing
list to the system.
>>> mlist.list_name
- '_xtest'
+ u'_xtest'
>>> mlist.host_name
- 'example.com'
+ u'example.com'
>>> mlist.fqdn_listname
- '_xtest@example.com'
+ u'_xtest@example.com'
If you try to create a mailing list with the same name as an existing list,
you will get an exception.
- >>> mlist_dup = listmgr.create('_xtest@example.com')
+ >>> mlist_dup = listmgr.create(u'_xtest@example.com')
Traceback (most recent call last):
...
MMListAlreadyExistsError: _xtest@example.com
@@ -54,9 +54,9 @@ Use the list manager to delete a mailing list.
After deleting the list, you can create it again.
- >>> mlist = listmgr.create('_xtest@example.com')
+ >>> mlist = listmgr.create(u'_xtest@example.com')
>>> mlist.fqdn_listname
- '_xtest@example.com'
+ u'_xtest@example.com'
Retrieving a mailing list
@@ -65,13 +65,13 @@ Retrieving a mailing list
When a mailing list exists, you can ask the list manager for it and you will
always get the same object back.
- >>> mlist_2 = listmgr.get('_xtest@example.com')
+ >>> mlist_2 = listmgr.get(u'_xtest@example.com')
>>> mlist_2 is mlist
True
If you try to get a list that doesn't existing yet, you get None.
- >>> print listmgr.get('_xtest_2@example.com')
+ >>> print listmgr.get(u'_xtest_2@example.com')
None
@@ -81,9 +81,9 @@ Iterating over all mailing lists
Once you've created a bunch of mailing lists, you can use the list manager to
iterate over either the list objects, or the list names.
- >>> mlist_3 = listmgr.create('_xtest_3@example.com')
- >>> mlist_4 = listmgr.create('_xtest_4@example.com')
+ >>> mlist_3 = listmgr.create(u'_xtest_3@example.com')
+ >>> mlist_4 = listmgr.create(u'_xtest_4@example.com')
>>> sorted(listmgr.names)
- ['_xtest@example.com', '_xtest_3@example.com', '_xtest_4@example.com']
+ [u'_xtest@example.com', u'_xtest_3@example.com', u'_xtest_4@example.com']
>>> sorted(m.fqdn_listname for m in listmgr.mailing_lists)
- ['_xtest@example.com', '_xtest_3@example.com', '_xtest_4@example.com']
+ [u'_xtest@example.com', u'_xtest_3@example.com', u'_xtest_4@example.com']
diff --git a/Mailman/docs/message.txt b/Mailman/docs/message.txt
index 4f0d08ce2..8f1e9c17c 100644
--- a/Mailman/docs/message.txt
+++ b/Mailman/docs/message.txt
@@ -13,7 +13,7 @@ instance, and then calls the .send() method on this object. This method
requires a mailing list instance.
>>> 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.preferred_language = u'en'
The UserNotification constructor takes the recipient address, the sender
diff --git a/Mailman/docs/messagestore.txt b/Mailman/docs/messagestore.txt
index 516ef257b..9b44a7e59 100644
--- a/Mailman/docs/messagestore.txt
+++ b/Mailman/docs/messagestore.txt
@@ -49,7 +49,7 @@ created above. Because Message-IDs are not guaranteed unique, looking up
messages with that key resturns a collection. The collection may be empty if
there are no matches.
- >>> list(store.get_messages_by_message_id('nothing'))
+ >>> list(store.get_messages_by_message_id(u'nothing'))
[]
Given an existing Message-ID, all matching messages will be found.
diff --git a/Mailman/docs/nntp.txt b/Mailman/docs/nntp.txt
index f8b837388..fefddd8b2 100644
--- a/Mailman/docs/nntp.txt
+++ b/Mailman/docs/nntp.txt
@@ -8,8 +8,8 @@ NNTP is to Usenet as IP is to the web, it's more general than that.
>>> from Mailman.Handlers.ToUsenet import process
>>> from Mailman.queue import Switchboard
>>> from Mailman.configuration import config
- >>> mlist = config.db.list_manager.create('_xtest@example.com')
- >>> mlist.preferred_language = 'en'
+ >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
+ >>> mlist.preferred_language = u'en'
>>> switchboard = Switchboard(config.NEWSQUEUE_DIR)
Gatewaying from the mailing list to the newsgroup happens through a separate
@@ -21,7 +21,7 @@ There are several situations which prevent a message from being gatewayed to
the newsgroup. The feature could be disabled, as is the default.
>>> mlist.gateway_to_news = False
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... Subject: An important message
...
... Something of great import.
@@ -48,8 +48,8 @@ However, other posted messages get gated to the newsgroup via the nntp queue.
The list owner can set the linked newsgroup and the nntp host that its
messages are gated to.
- >>> mlist.linked_newsgroup = 'comp.lang.thing'
- >>> mlist.nntp_host = 'news.example.com'
+ >>> mlist.linked_newsgroup = u'comp.lang.thing'
+ >>> mlist.nntp_host = u'news.example.com'
>>> process(mlist, msg, {})
>>> len(switchboard.files)
1
@@ -63,6 +63,6 @@ messages are gated to.
<BLANKLINE>
>>> sorted(msgdata.items())
[('_parsemsg', False),
- ('listname', '_xtest@example.com'),
+ ('listname', u'_xtest@example.com'),
('received_time', ...),
('version', 3)]
diff --git a/Mailman/docs/outgoing.txt b/Mailman/docs/outgoing.txt
index 48bc287b8..ba2c6430b 100644
--- a/Mailman/docs/outgoing.txt
+++ b/Mailman/docs/outgoing.txt
@@ -12,7 +12,7 @@ headers for unambigous bounce processing.
>>> from Mailman.Handlers.ToOutgoing import process
>>> from Mailman.queue import Switchboard
>>> from Mailman.configuration import config
- >>> mlist = config.db.list_manager.create('_xtest@example.com')
+ >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
>>> switchboard = Switchboard(config.OUTQUEUE_DIR)
>>> def queue_size():
@@ -56,7 +56,7 @@ additional key set: the mailing list name.
>>> sorted(qmsgdata.items())
[('_parsemsg', False),
('bar', 2), ('foo', 1),
- ('listname', '_xtest@example.com'),
+ ('listname', u'_xtest@example.com'),
('received_time', ...),
('verp', True), ('version', 3)]
>>> queue_size()
@@ -66,9 +66,11 @@ If the list is set to personalize deliveries, and the global configuration
option to VERP personalized deliveries is set, then the message will be
VERP'd.
+ # Save the original value for clean up.
+ >>> verp_personalized_delivieries = config.VERP_PERSONALIZED_DELIVERIES
+ >>> config.VERP_PERSONALIZED_DELIVERIES = True
>>> from Mailman.interfaces import Personalization
>>> mlist.personalize = Personalization.individual
- >>> config.VERP_PERSONALIZED_DELIVERIES = True
>>> msgdata = dict(foo=1, bar=2)
>>> process(mlist, msg, msgdata)
>>> msgdata['verp']
@@ -92,8 +94,10 @@ the global configuration variable VERP_DELIVERY_INTERVAL. This variable tells
Mailman how often to VERP even non-personalized mailing lists. It can be set
to zero, which means non-personalized messages will never be VERP'd.
- >>> mlist.personalize = Personalization.none
+ # Save the original value for clean up.
+ >>> verp_delivery_interval = config.VERP_DELIVERY_INTERVAL
>>> config.VERP_DELIVERY_INTERVAL = 0
+ >>> mlist.personalize = Personalization.none
>>> msgdata = dict(foo=1, bar=2)
>>> process(mlist, msg, msgdata)
>>> print msgdata.get('verp')
@@ -142,3 +146,10 @@ will be VERP'd.
9 True
>>> queue_size()
10
+
+
+Clean up
+========
+
+ >>> config.VERP_PERSONALIZED_DELIVERIES = verp_personalized_delivieries
+ >>> config.VERP_DELIVERY_INTERVAL = verp_delivery_interval
diff --git a/Mailman/docs/requests.txt b/Mailman/docs/requests.txt
index febf3e430..3ef272c9e 100644
--- a/Mailman/docs/requests.txt
+++ b/Mailman/docs/requests.txt
@@ -14,7 +14,7 @@ Here is a helper function for printing out held requests.
... key, data = requests.get_request(request.id)
... if data is not None:
... data = sorted(data.items())
- ... print request.id, str(request.type), key, data
+ ... print request.id, str(request.request_type), key, data
And another helper for displaying messages in the virgin queue.
@@ -65,10 +65,10 @@ of associated data. The request database assigns no semantics to the held
data, except for the request type. Here we hold some simple bits of data.
>>> from Mailman.interfaces import RequestType
- >>> id_1 = requests.hold_request(RequestType.held_message, 'hold_1')
- >>> id_2 = requests.hold_request(RequestType.subscription, 'hold_2')
- >>> id_3 = requests.hold_request(RequestType.unsubscription, 'hold_3')
- >>> id_4 = requests.hold_request(RequestType.held_message, 'hold_4')
+ >>> id_1 = requests.hold_request(RequestType.held_message, u'hold_1')
+ >>> id_2 = requests.hold_request(RequestType.subscription, u'hold_2')
+ >>> id_3 = requests.hold_request(RequestType.unsubscription, u'hold_3')
+ >>> id_4 = requests.hold_request(RequestType.held_message, u'hold_4')
>>> id_1, id_2, id_3, id_4
(1, 2, 3, 4)
@@ -98,7 +98,7 @@ If we try to hold a request with a bogus type, we get an exception.
We can hold requests with additional data.
>>> data = dict(foo='yes', bar='no')
- >>> id_5 = requests.hold_request(RequestType.held_message, 'hold_5', data)
+ >>> id_5 = requests.hold_request(RequestType.held_message, u'hold_5', data)
>>> id_5
5
>>> requests.count
@@ -212,7 +212,6 @@ For this section, we need a mailing list and at least one message.
>>> mlist = config.db.list_manager.create('alist@example.com')
>>> mlist.preferred_language = 'en'
>>> mlist.real_name = 'A Test List'
- >>> from email import message_from_string
>>> msg = message_from_string(u"""\
... From: aperson@example.org
... To: alist@example.com
diff --git a/Mailman/docs/runner.txt b/Mailman/docs/runner.txt
index 4143c36a6..5e5a88d8c 100644
--- a/Mailman/docs/runner.txt
+++ b/Mailman/docs/runner.txt
@@ -64,8 +64,7 @@ on instance variables.
>>> sorted(runner.msgdata.items())
[('_parsemsg', False),
('bar', 'no'), ('foo', 'yes'),
- ('lang', 'en'), ('listname', '_xtest@example.com'),
+ ('lang', u'en'), ('listname', u'_xtest@example.com'),
('received_time', ...), ('version', 3)]
-
XXX More of the Runner API should be tested.
diff --git a/Mailman/docs/switchboard.txt b/Mailman/docs/switchboard.txt
index ce8f277ed..299aba499 100644
--- a/Mailman/docs/switchboard.txt
+++ b/Mailman/docs/switchboard.txt
@@ -4,21 +4,19 @@ The switchboard
The switchboard is subsystem that moves messages between queues. Each
instance of a switchboard is responsible for one queue directory.
- >>> from email import message_from_string
- >>> from Mailman.Message import Message
- >>> from Mailman.queue import Switchboard
- >>> msg = message_from_string("""\
+ >>> msg = message_from_string(u"""\
... From: aperson@example.com
... To: _xtest@example.com
...
... A test message.
- ... """, Message)
+ ... """)
Create a switchboard by giving its queue directory.
>>> import os
>>> from Mailman.configuration import config
>>> queue_directory = os.path.join(config.QUEUE_DIR, 'test')
+ >>> from Mailman.queue import Switchboard
>>> switchboard = Switchboard(queue_directory)
>>> switchboard.queue_directory == queue_directory
True