------------------------------------------------------------
revno: 6781
committer: Barry Warsaw <[email protected]>
branch nick: 3.0
timestamp: Fri 2009-08-21 18:07:35 -0400
message:
Test updates and repair.xo
modified:
src/mailman/bin/list_members.py
src/mailman/bin/list_owners.py
src/mailman/bin/withlist.py
src/mailman/commands/docs/create.txt
src/mailman/commands/docs/remove.txt
src/mailman/docs/bounces.txt
src/mailman/docs/lifecycle.txt
src/mailman/docs/listmanager.txt
src/mailman/docs/mlist-addresses.txt
src/mailman/docs/styles.txt
src/mailman/mta/postfix.py
src/mailman/pipeline/docs/ack-headers.txt
src/mailman/pipeline/docs/acknowledge.txt
src/mailman/pipeline/docs/after-delivery.txt
src/mailman/pipeline/docs/avoid-duplicates.txt
src/mailman/pipeline/docs/calc-recips.txt
src/mailman/pipeline/docs/cleanse.txt
src/mailman/pipeline/docs/decorate.txt
src/mailman/pipeline/docs/file-recips.txt
src/mailman/pipeline/docs/nntp.txt
src/mailman/pipeline/docs/reply-to.txt
src/mailman/pipeline/docs/scrubber.txt
src/mailman/pipeline/docs/subject-munging.txt
src/mailman/pipeline/docs/tagger.txt
src/mailman/pipeline/docs/to-outgoing.txt
src/mailman/queue/__init__.py
src/mailman/queue/docs/news.txt
src/mailman/queue/docs/runner.txt
src/mailman/queue/lmtp.py
src/mailman/rest/docs/lists.txt
src/mailman/rest/urls.py
src/mailman/rest/webservice.py
src/mailman/rules/docs/administrivia.txt
src/mailman/rules/docs/approve.txt
src/mailman/rules/docs/loop.txt
src/mailman/rules/docs/max-size.txt
src/mailman/rules/docs/moderation.txt
src/mailman/rules/docs/news-moderation.txt
src/mailman/rules/docs/no-subject.txt
src/mailman/rules/docs/recipients.txt
src/mailman/rules/docs/rules.txt
src/mailman/rules/docs/suspicious.txt
--
lp:mailman
https://code.launchpad.net/~mailman-coders/mailman/3.0
Your team Mailman Checkins is subscribed to branch lp:mailman.
To unsubscribe from this branch go to
https://code.launchpad.net/~mailman-coders/mailman/3.0/+edit-subscription.
=== modified file 'src/mailman/bin/list_members.py'
--- src/mailman/bin/list_members.py 2009-02-13 03:52:18 +0000
+++ src/mailman/bin/list_members.py 2009-08-21 22:07:35 +0000
@@ -23,7 +23,8 @@
from mailman.core import errors
from mailman.email.validate import is_valid
from mailman.i18n import _
-from mailman.interfaces import DeliveryStatus
+from mailman.interfaces.listmanager import IListManager
+from mailman.interfaces.members import DeliveryStatus
from mailman.options import SingleMailingListOptions
@@ -142,7 +143,7 @@
else:
fp = sys.stdout
- mlist = config.db.list_manager.get(fqdn_listname)
+ mlist = IListManager(config).get(fqdn_listname)
if mlist is None:
options.parser.error(_('No such list: $fqdn_listname'))
=== modified file 'src/mailman/bin/list_owners.py'
--- src/mailman/bin/list_owners.py 2009-01-01 22:16:51 +0000
+++ src/mailman/bin/list_owners.py 2009-08-21 22:07:35 +0000
@@ -22,6 +22,7 @@
from mailman.configuration import config
from mailman.i18n import _
from mailman.initialize import initialize
+from mailman.interfaces.listmanager import IListManager
from mailman.version import MAILMAN_VERSION
@@ -53,7 +54,7 @@
parser, opts, args = parseargs()
initialize(opts.config)
- listmgr = config.db.list_manager
+ listmgr = IListManager(config)
listnames = set(args or listmgr.names)
bylist = {}
=== modified file 'src/mailman/bin/withlist.py'
--- src/mailman/bin/withlist.py 2009-01-05 00:41:05 +0000
+++ src/mailman/bin/withlist.py 2009-08-21 22:07:35 +0000
@@ -23,6 +23,7 @@
from mailman.config import config
from mailman.core.initialize import initialize
from mailman.i18n import _
+from mailman.interfaces.listmanager import IListManager
from mailman.version import MAILMAN_VERSION
@@ -40,7 +41,7 @@
# XXX FIXME Remove this when this script is converted to
# MultipleMailingListOptions.
listname = listname.decode(sys.getdefaultencoding())
- mlist = config.db.list_manager.get(listname)
+ mlist = IListManager(config).get(listname)
if mlist is None:
print >> sys.stderr, _('Unknown list: $listname')
else:
=== modified file 'src/mailman/commands/docs/create.txt'
--- src/mailman/commands/docs/create.txt 2009-08-15 00:39:43 +0000
+++ src/mailman/commands/docs/create.txt 2009-08-21 22:07:35 +0000
@@ -36,7 +36,9 @@
Now both the domain and the mailing list exist in the database.
- >>> config.db.list_manager.get('[email protected]')
+ >>> from mailman.interfaces.listmanager import IListManager
+ >>> list_manager = IListManager(config)
+ >>> list_manager.get('[email protected]')
<mailing list "[email protected]" at ...>
>>> from mailman.interfaces.domain import IDomainManager
@@ -52,7 +54,7 @@
>>> command.process(args)
Created mailing list: [email protected]
- >>> config.db.list_manager.get('[email protected]')
+ >>> list_manager.get('[email protected]')
<mailing list "[email protected]" at ...>
The command can also operate quietly.
@@ -61,7 +63,7 @@
>>> args.listname = ['[email protected]']
>>> command.process(args)
- >>> mlist = config.db.list_manager.get('[email protected]')
+ >>> mlist = list_manager.get('[email protected]')
>>> mlist
<mailing list "[email protected]" at ...>
@@ -83,7 +85,7 @@
>>> command.process(args)
Created mailing list: [email protected]
- >>> mlist = config.db.list_manager.get('[email protected]')
+ >>> mlist = list_manager.get('[email protected]')
>>> print list(mlist.owners.addresses)
[<Address: [email protected] [not verified] at ...>]
@@ -94,7 +96,7 @@
>>> command.process(args)
Created mailing list: [email protected]
- >>> mlist = config.db.list_manager.get('[email protected]')
+ >>> mlist = list_manager.get('[email protected]')
>>> from operator import attrgetter
>>> print sorted(mlist.owners.addresses, key=attrgetter('address'))
[<Address: [email protected] [not verified] at ...>,
@@ -121,7 +123,7 @@
>>> command.process(args)
Created mailing list: [email protected]
- >>> mlist = config.db.list_manager.get('[email protected]')
+ >>> mlist = list_manager.get('[email protected]')
>>> print mlist.preferred_language
<Language [it] Italian>
>>> args.language = None
=== modified file 'src/mailman/commands/docs/remove.txt'
--- src/mailman/commands/docs/remove.txt 2009-08-15 00:39:43 +0000
+++ src/mailman/commands/docs/remove.txt 2009-08-21 22:07:35 +0000
@@ -8,7 +8,9 @@
>>> create_list('[email protected]')
<mailing list "[email protected]" at ...>
- >>> config.db.list_manager.get('[email protected]')
+ >>> from mailman.interfaces.listmanager import IListManager
+ >>> list_manager = IListManager(config)
+ >>> list_manager.get('[email protected]')
<mailing list "[email protected]" at ...>
>>> class FakeArgs:
@@ -23,7 +25,7 @@
Removed list: [email protected]
Not removing archives. Reinvoke with -a to remove them.
- >>> print config.db.list_manager.get('[email protected]')
+ >>> print list_manager.get('[email protected]')
None
You can also remove lists quietly.
@@ -35,7 +37,7 @@
>>> args.quiet = True
>>> command.process(args)
- >>> print config.db.list_manager.get('[email protected]')
+ >>> print list_manager.get('[email protected]')
None
=== modified file 'src/mailman/docs/bounces.txt'
--- src/mailman/docs/bounces.txt 2009-07-17 05:16:27 +0000
+++ src/mailman/docs/bounces.txt 2009-08-21 22:07:35 +0000
@@ -13,7 +13,8 @@
essentially equivalent to rejecting the message with notification. Mailing
lists can bounce a message with an optional error message.
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.interfaces.listmanager import IListManager
+ >>> mlist = IListManager(config).create('[email protected]')
>>> mlist.preferred_language = 'en'
Any message can be bounced.
=== modified file 'src/mailman/docs/lifecycle.txt'
--- src/mailman/docs/lifecycle.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/docs/lifecycle.txt 2009-08-21 22:07:35 +0000
@@ -125,7 +125,9 @@
>>> from mailman.app.lifecycle import remove_list
>>> remove_list(mlist_2.fqdn_listname, mlist_2, True)
- >>> print config.db.list_manager.get('[email protected]')
+
+ >>> from mailman.interfaces.listmanager import IListManager
+ >>> print IListManager(config).get('[email protected]')
None
We should now be able to completely recreate the mailing list.
=== modified file 'src/mailman/docs/listmanager.txt'
--- src/mailman/docs/listmanager.txt 2009-07-17 05:16:27 +0000
+++ src/mailman/docs/listmanager.txt 2009-08-21 22:07:35 +0000
@@ -8,9 +8,7 @@
on the global config object.
>>> from mailman.interfaces.listmanager import IListManager
- >>> listmgr = config.db.list_manager
- >>> IListManager.providedBy(listmgr)
- True
+ >>> list_manager = IListManager(config)
Creating a mailing list
@@ -19,7 +17,7 @@
Creating the list returns the newly created IMailList object.
>>> from mailman.interfaces.mailinglist import IMailingList
- >>> mlist = listmgr.create('[email protected]')
+ >>> mlist = list_manager.create('[email protected]')
>>> IMailingList.providedBy(mlist)
True
@@ -37,7 +35,7 @@
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('[email protected]')
+ >>> mlist_dup = list_manager.create('[email protected]')
Traceback (most recent call last):
...
ListAlreadyExistsError: [email protected]
@@ -48,13 +46,13 @@
Use the list manager to delete a mailing list.
- >>> listmgr.delete(mlist)
- >>> sorted(listmgr.names)
+ >>> list_manager.delete(mlist)
+ >>> sorted(list_manager.names)
[]
After deleting the list, you can create it again.
- >>> mlist = listmgr.create('[email protected]')
+ >>> mlist = list_manager.create('[email protected]')
>>> print mlist.fqdn_listname
[email protected]
@@ -65,13 +63,13 @@
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('[email protected]')
+ >>> mlist_2 = list_manager.get('[email protected]')
>>> mlist_2 is mlist
True
If you try to get a list that doesn't existing yet, you get None.
- >>> print listmgr.get('[email protected]')
+ >>> print list_manager.get('[email protected]')
None
@@ -81,9 +79,9 @@
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('[email protected]')
- >>> mlist_4 = listmgr.create('[email protected]')
- >>> sorted(listmgr.names)
+ >>> mlist_3 = list_manager.create('[email protected]')
+ >>> mlist_4 = list_manager.create('[email protected]')
+ >>> sorted(list_manager.names)
[u'[email protected]', u'[email protected]', u'[email protected]']
- >>> sorted(m.fqdn_listname for m in listmgr.mailing_lists)
+ >>> sorted(m.fqdn_listname for m in list_manager.mailing_lists)
[u'[email protected]', u'[email protected]', u'[email protected]']
=== modified file 'src/mailman/docs/mlist-addresses.txt'
--- src/mailman/docs/mlist-addresses.txt 2009-07-17 05:16:27 +0000
+++ src/mailman/docs/mlist-addresses.txt 2009-08-21 22:07:35 +0000
@@ -4,7 +4,8 @@
Every mailing list has a number of addresses which are publicly available.
These are defined in the IMailingListAddresses interface.
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.interfaces.listmanager import IListManager
+ >>> mlist = IListManager(config).create('[email protected]')
The posting address is where people send messages to be posted to the mailing
list. This is exactly the same as the fully qualified list name.
=== modified file 'src/mailman/docs/styles.txt'
--- src/mailman/docs/styles.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/docs/styles.txt 2009-08-21 22:07:35 +0000
@@ -14,7 +14,8 @@
Let's start with a vanilla mailing list and a default style manager.
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.interfaces.listmanager import IListManager
+ >>> mlist = IListManager(config).create('[email protected]')
>>> from mailman.styles.manager import StyleManager
>>> style_manager = StyleManager()
>>> style_manager.populate()
=== modified file 'src/mailman/mta/postfix.py'
--- src/mailman/mta/postfix.py 2009-01-17 02:04:21 +0000
+++ src/mailman/mta/postfix.py 2009-08-21 22:07:35 +0000
@@ -38,6 +38,7 @@
from mailman import Utils
from mailman.config import config
+from mailman.interfaces.listmanager import IListManager
from mailman.interfaces.mta import IMailTransportAgent
from mailman.i18n import _
@@ -79,7 +80,7 @@
# Sort all existing mailing list names first by domain, then my local
# part. For postfix we need a dummy entry for the domain.
by_domain = {}
- for mailing_list in config.db.list_manager.mailing_lists:
+ for mailing_list in IListManager(config).mailing_lists:
by_domain.setdefault(mailing_list.host_name, []).append(
mailing_list.list_name)
with open(path + '.new', 'w') as fp:
=== modified file 'src/mailman/pipeline/docs/ack-headers.txt'
--- src/mailman/pipeline/docs/ack-headers.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/ack-headers.txt 2009-08-21 22:07:35 +0000
@@ -8,8 +8,8 @@
changes depend on mailing list settings and others depend on how the message
is getting sent through the system. We'll take things one-by-one.
- >>> from mailman.pipeline.cook_headers import process
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> mlist.subject_prefix = ''
When the message's metadata has a 'noack' key set, an 'X-Ack: no' header is
@@ -20,6 +20,8 @@
...
... A message of great import.
... """)
+
+ >>> from mailman.pipeline.cook_headers import process
>>> process(mlist, msg, dict(noack=True))
>>> print msg.as_string()
From: [email protected]
=== modified file 'src/mailman/pipeline/docs/acknowledge.txt'
--- src/mailman/pipeline/docs/acknowledge.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/acknowledge.txt 2009-08-21 22:07:35 +0000
@@ -6,8 +6,8 @@
receive acknowledgments of their postings, Mailman will sent them such an
acknowledgment.
- >>> handler = config.handlers['acknowledge']
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> mlist.real_name = 'XTest'
>>> mlist.preferred_language = 'en'
>>> # XXX This will almost certainly change once we've worked out the web
@@ -38,6 +38,8 @@
... From: [email protected]
...
... """)
+
+ >>> handler = config.handlers['acknowledge']
>>> handler.process(mlist, msg, {})
>>> virginq.files
[]
=== modified file 'src/mailman/pipeline/docs/after-delivery.txt'
--- src/mailman/pipeline/docs/after-delivery.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/after-delivery.txt 2009-08-21 22:07:35 +0000
@@ -7,8 +7,8 @@
bookkeeping pieces of information are updated.
>>> import datetime
- >>> handler = config.handlers['after-delivery']
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> post_time = datetime.datetime.now() - datetime.timedelta(minutes=10)
>>> mlist.last_post_time = post_time
>>> mlist.post_id = 10
@@ -21,6 +21,8 @@
...
... Something interesting.
... """)
+
+ >>> handler = config.handlers['after-delivery']
>>> handler.process(mlist, msg, {})
>>> mlist.last_post_time > post_time
True
=== modified file 'src/mailman/pipeline/docs/avoid-duplicates.txt'
--- src/mailman/pipeline/docs/avoid-duplicates.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/avoid-duplicates.txt 2009-08-21 22:07:35 +0000
@@ -7,8 +7,8 @@
recipients from the list of recipients that earlier handler modules
(e.g. CalcRecips) calculates.
- >>> handler = config.handlers['avoid-duplicates']
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
Create some members we're going to use.
@@ -36,6 +36,8 @@
... Something
... """)
>>> msgdata = {}
+
+ >>> handler = config.handlers['avoid-duplicates']
>>> handler.process(mlist, msg, msgdata)
>>> msgdata
{}
=== modified file 'src/mailman/pipeline/docs/calc-recips.txt'
--- src/mailman/pipeline/docs/calc-recips.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/calc-recips.txt 2009-08-21 22:07:35 +0000
@@ -6,8 +6,8 @@
of recipient addresses. These addresses are calculated by one of the handler
modules and depends on a host of factors.
- >>> handler = config.handlers['calculate-recipients']
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
Recipients are calculate from the list members, so add a bunch of members to
start out with. First, create a bunch of addresses...
@@ -52,6 +52,8 @@
... """)
>>> recips = set(('[email protected]', '[email protected]'))
>>> msgdata = dict(recips=recips)
+
+ >>> handler = config.handlers['calculate-recipients']
>>> handler.process(mlist, msg, msgdata)
>>> sorted(msgdata['recips'])
[u'[email protected]', u'[email protected]']
=== modified file 'src/mailman/pipeline/docs/cleanse.txt'
--- src/mailman/pipeline/docs/cleanse.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/cleanse.txt 2009-08-21 22:07:35 +0000
@@ -6,8 +6,8 @@
related to additional permissions that can be granted to the message and other
headers can be used to fish for membership.
- >>> handler = config.handlers['cleanse']
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
Headers such as Approved, Approve, and Urgent are used to grant special
pemissions to individual messages. All may contain a password; the first two
@@ -25,6 +25,8 @@
...
... Blah blah blah
... """)
+
+ >>> handler = config.handlers['cleanse']
>>> handler.process(mlist, msg, {})
>>> print msg.as_string()
From: [email protected]
=== modified file 'src/mailman/pipeline/docs/decorate.txt'
--- src/mailman/pipeline/docs/decorate.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/decorate.txt 2009-08-21 22:07:35 +0000
@@ -6,8 +6,8 @@
original message. A handler module takes care of this based on the settings
of the mailing list and the type of message being processed.
- >>> from mailman.pipeline.decorate import process
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> msg_text = """\
... From: [email protected]
...
@@ -22,6 +22,7 @@
Digest messages get decorated during the digest creation phase so no extra
decorations are added for digest messages.
+ >>> from mailman.pipeline.decorate import process
>>> process(mlist, msg, dict(isdigest=True))
>>> print msg.as_string()
From: [email protected]
=== modified file 'src/mailman/pipeline/docs/file-recips.txt'
--- src/mailman/pipeline/docs/file-recips.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/file-recips.txt 2009-08-21 22:07:35 +0000
@@ -6,8 +6,8 @@
include file. This file must be called members.txt and it must live in the
list's data directory.
- >>> handler = config.handlers['file-recipients']
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
Short circuiting
@@ -22,6 +22,8 @@
... A message.
... """)
>>> msgdata = {'recips': 7}
+
+ >>> handler = config.handlers['file-recipients']
>>> handler.process(mlist, msg, msgdata)
>>> print msg.as_string()
From: [email protected]
=== modified file 'src/mailman/pipeline/docs/nntp.txt'
--- src/mailman/pipeline/docs/nntp.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/nntp.txt 2009-08-21 22:07:35 +0000
@@ -6,10 +6,8 @@
be forwarded onto an NNTP newsgroup. Typically this means Usenet, but since
NNTP is to Usenet as IP is to the web, it's more general than that.
- >>> handler = config.handlers['to-usenet']
- >>> mlist = config.db.list_manager.create('[email protected]')
- >>> mlist.preferred_language = 'en'
- >>> switchboard = config.switchboards['news']
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
Gatewaying from the mailing list to the newsgroup happens through a separate
'nntp' queue and happen immediately when the message is posted through to the
@@ -25,7 +23,11 @@
...
... Something of great import.
... """)
+
+ >>> handler = config.handlers['to-usenet']
>>> handler.process(mlist, msg, {})
+
+ >>> switchboard = config.switchboards['news']
>>> switchboard.files
[]
=== modified file 'src/mailman/pipeline/docs/reply-to.txt'
--- src/mailman/pipeline/docs/reply-to.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/reply-to.txt 2009-08-21 22:07:35 +0000
@@ -8,9 +8,8 @@
changes depend on mailing list settings and others depend on how the message
is getting sent through the system. We'll take things one-by-one.
- >>> from mailman.pipeline.cook_headers import process
- >>> mlist = config.db.list_manager.create('[email protected]')
- >>> mlist.subject_prefix = ''
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
Reply-to munging refers to the behavior where a mailing list can be configured
to change or augment an existing Reply-To header in a message posted to the
@@ -45,6 +44,8 @@
... From: [email protected]
...
... """)
+
+ >>> from mailman.pipeline.cook_headers import process
>>> process(mlist, msg, {})
>>> len(msg.get_all('reply-to'))
1
=== modified file 'src/mailman/pipeline/docs/scrubber.txt'
--- src/mailman/pipeline/docs/scrubber.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/scrubber.txt 2009-08-21 22:07:35 +0000
@@ -7,8 +7,8 @@
scrub attachments from messages so that binary goop doesn't end up in an
archive message.
- >>> from mailman.pipeline.scrubber import process, save_attachment
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> mlist.preferred_language = 'en'
Helper functions for getting the attachment data.
@@ -41,7 +41,7 @@
Saving attachments
==================
-The Scrubber handler exposes a function called save_attachments() which can be
+The Scrubber handler exposes a function called save_attachment() which can be
used to strip various types of attachments and store them in the archive
directory. This is a public interface used by components outside the normal
processing pipeline.
@@ -62,6 +62,8 @@
...
... R0lGODdhAQABAIAAAAAAAAAAACwAAAAAAQABAAACAQUAOw==
... """)
+
+ >>> from mailman.pipeline.scrubber import save_attachment
>>> print save_attachment(mlist, msg, 'dir')
<http://www.example.com/pipermail/[email protected]/dir/xtest.gif>
>>> data = read_attachment('dir/xtest.gif')
@@ -134,6 +136,7 @@
The Scrubber.process() function is different than other handler process
functions in that it returns the scrubbed message.
+ >>> from mailman.pipeline.scrubber import process
>>> scrubbed_msg = process(mlist, msg, msgdata)
>>> scrubbed_msg is msg
True
=== modified file 'src/mailman/pipeline/docs/subject-munging.txt'
--- src/mailman/pipeline/docs/subject-munging.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/subject-munging.txt 2009-08-21 22:07:35 +0000
@@ -8,9 +8,8 @@
changes depend on mailing list settings and others depend on how the message
is getting sent through the system. We'll take things one-by-one.
- >>> from mailman.pipeline.cook_headers import process
- >>> mlist = config.db.list_manager.create('[email protected]')
- >>> mlist.subject_prefix = ''
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
Inserting a prefix
@@ -29,6 +28,8 @@
... A message of great import.
... """)
>>> msgdata = {}
+
+ >>> from mailman.pipeline.cook_headers import process
>>> process(mlist, msg, msgdata)
The original subject header is stored in the message metadata. We must print
=== modified file 'src/mailman/pipeline/docs/tagger.txt'
--- src/mailman/pipeline/docs/tagger.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/tagger.txt 2009-08-21 22:07:35 +0000
@@ -9,8 +9,8 @@
its Subject: and Keywords: headers compared against these regular
expressions. The message then gets tagged with the topic names of each hit.
- >>> from mailman.pipeline.tagger import process
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
Topics must be enabled for Mailman to do any topic matching, even if topics
are defined.
@@ -25,6 +25,8 @@
...
... """)
>>> msgdata = {}
+
+ >>> from mailman.pipeline.tagger import process
>>> process(mlist, msg, msgdata)
>>> print msg.as_string()
Subject: foobar
=== modified file 'src/mailman/pipeline/docs/to-outgoing.txt'
--- src/mailman/pipeline/docs/to-outgoing.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/pipeline/docs/to-outgoing.txt 2009-08-21 22:07:35 +0000
@@ -10,10 +10,10 @@
basically describes how to encode the recipient's address in the originator
headers for unambigous bounce processing.
- >>> handler = config.handlers['to-outgoing']
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
+
>>> switchboard = config.switchboards['out']
-
>>> def queue_size():
... size = len(switchboard.files)
... for filebase in switchboard.files:
@@ -34,6 +34,8 @@
the message metadata already has a VERP key, this message will be VERP'd.
>>> msgdata = dict(foo=1, bar=2, verp=True)
+
+ >>> handler = config.handlers['to-outgoing']
>>> handler.process(mlist, msg, msgdata)
>>> print msg.as_string()
Subject: Here is a message
=== modified file 'src/mailman/queue/__init__.py'
--- src/mailman/queue/__init__.py 2009-05-12 02:08:07 +0000
+++ src/mailman/queue/__init__.py 2009-08-21 22:07:35 +0000
@@ -52,6 +52,7 @@
from mailman import i18n
from mailman.config import config
from mailman.email.message import Message
+from mailman.interfaces.listmanager import IListManager
from mailman.interfaces.runner import IRunner
from mailman.interfaces.switchboard import ISwitchboard
from mailman.utilities.filesystem import makedirs
@@ -417,7 +418,7 @@
#
# Find out which mailing list this message is destined for.
listname = unicode(msgdata.get('listname'))
- mlist = config.db.list_manager.get(listname)
+ mlist = IListManager(config).get(listname)
if mlist is None:
elog.error('Dequeuing message destined for missing list: %s',
listname)
=== modified file 'src/mailman/queue/docs/news.txt'
--- src/mailman/queue/docs/news.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/queue/docs/news.txt 2009-08-21 22:07:35 +0000
@@ -7,8 +7,8 @@
the message for Usenet (yes, I know that NNTP is not Usenet, but this runner
was originally written to gate to Usenet, which has its own rules).
- >>> from mailman.queue.news import prepare_message
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> mlist.linked_newsgroup = 'comp.lang.python'
Some NNTP servers such as INN reject messages containing a set of prohibited
@@ -33,6 +33,8 @@
... A message
... """)
>>> msgdata = {}
+
+ >>> from mailman.queue.news import prepare_message
>>> prepare_message(mlist, msg, msgdata)
>>> msgdata['prepped']
True
=== modified file 'src/mailman/queue/docs/runner.txt'
--- src/mailman/queue/docs/runner.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/queue/docs/runner.txt 2009-08-21 22:07:35 +0000
@@ -15,8 +15,8 @@
runners inherit from. This base class implements a .run() method that runs
continuously in a loop until the .stop() method is called.
- >>> mlist = config.db.list_manager.create('[email protected]')
- >>> mlist.preferred_language = 'en'
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
Here is a very simple derived qrunner class. Queue runners use a
configuration section in the configuration files to determine run
=== modified file 'src/mailman/queue/lmtp.py'
--- src/mailman/queue/lmtp.py 2009-05-16 15:08:46 +0000
+++ src/mailman/queue/lmtp.py 2009-08-21 22:07:35 +0000
@@ -41,6 +41,7 @@
from mailman.config import config
from mailman.database.transaction import txn
from mailman.email.message import Message
+from mailman.interfaces.listmanager import IListManager
from mailman.queue import Runner
elog = logging.getLogger('mailman.error')
@@ -133,7 +134,7 @@
try:
# Refresh the list of list names every time we process a message
# since the set of mailing lists could have changed.
- listnames = set(config.db.list_manager.names)
+ listnames = set(IListManager(config).names)
qlog.debug('listnames: %s', listnames)
# Parse the message data. If there are any defects in the
# message, reject it right away; it's probably spam.
=== modified file 'src/mailman/rest/docs/lists.txt'
--- src/mailman/rest/docs/lists.txt 2009-08-08 03:46:41 +0000
+++ src/mailman/rest/docs/lists.txt 2009-08-21 22:07:35 +0000
@@ -54,7 +54,8 @@
The mailing list exists in the database.
- >>> config.db.list_manager.get('[email protected]')
+ >>> from mailman.interfaces.listmanager import IListManager
+ >>> IListManager(config).get('[email protected]')
<mailing list "[email protected]" at ...>
# The above starts a Storm transaction, which will lock the database
=== modified file 'src/mailman/rest/urls.py'
--- src/mailman/rest/urls.py 2009-08-08 03:46:41 +0000
+++ src/mailman/rest/urls.py 2009-08-21 22:07:35 +0000
@@ -33,6 +33,7 @@
from mailman.config import config
from mailman.core.system import system
+from mailman.interfaces.listmanager import IListManager
from mailman.rest.configuration import AdminWebServiceConfiguration
from mailman.rest.webservice import AdminWebServiceApplication
@@ -81,7 +82,7 @@
return ''
urls = {
system: 'system',
- config.db.list_manager: 'lists',
+ IListManager(config): 'lists',
}
return urls[ob]
=== modified file 'src/mailman/rest/webservice.py'
--- src/mailman/rest/webservice.py 2009-08-17 18:40:03 +0000
+++ src/mailman/rest/webservice.py 2009-08-21 22:07:35 +0000
@@ -41,6 +41,7 @@
from mailman.config import config
from mailman.core.system import system
from mailman.interfaces.domain import IDomainCollection, IDomainManager
+from mailman.interfaces.listmanager import IListManager
from mailman.interfaces.rest import IResolvePathNames
from mailman.rest.publication import AdminWebServicePublication
@@ -79,7 +80,7 @@
top_level = dict(
system=system,
domains=IDomainCollection(IDomainManager(config)),
- lists=config.db.list_manager,
+ lists=IListManager(config),
)
next_step = top_level.get(name)
log.debug('Top level name: %s -> %s', name, next_step)
=== modified file 'src/mailman/rules/docs/administrivia.txt'
--- src/mailman/rules/docs/administrivia.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/rules/docs/administrivia.txt 2009-08-21 22:07:35 +0000
@@ -7,7 +7,8 @@
used to catch messages posted to the list which should have been sent to the
-request robot address.
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> mlist.administrivia = True
>>> rule = config.rules['administrivia']
>>> print rule.name
=== modified file 'src/mailman/rules/docs/approve.txt'
--- src/mailman/rules/docs/approve.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/rules/docs/approve.txt 2009-08-21 22:07:35 +0000
@@ -14,7 +14,8 @@
In order to support this, a mailing list can be given a 'moderator password'
which is shared among all the administrators.
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> mlist.moderator_password = 'abcxyz'
The 'approved' rule determines whether the message contains the proper
=== modified file 'src/mailman/rules/docs/loop.txt'
--- src/mailman/rules/docs/loop.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/rules/docs/loop.txt 2009-08-21 22:07:35 +0000
@@ -5,7 +5,8 @@
To avoid a posting loop, Mailman has a rule to check for the existence of an
X-BeenThere header with the value of the list's posting address.
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> rule = config.rules['loop']
>>> print rule.name
loop
=== modified file 'src/mailman/rules/docs/max-size.txt'
--- src/mailman/rules/docs/max-size.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/rules/docs/max-size.txt 2009-08-21 22:07:35 +0000
@@ -7,7 +7,8 @@
getting posted to the list. This value is calculated in terms of KB (1024
bytes).
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> rule = config.rules['max-size']
>>> print rule.name
max-size
=== modified file 'src/mailman/rules/docs/moderation.txt'
--- src/mailman/rules/docs/moderation.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/rules/docs/moderation.txt 2009-08-21 22:07:35 +0000
@@ -7,7 +7,8 @@
email the list without having those messages be held for approval. The
'moderation' rule determines whether the message should be moderated or not.
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> rule = config.rules['moderation']
>>> print rule.name
moderation
=== modified file 'src/mailman/rules/docs/news-moderation.txt'
--- src/mailman/rules/docs/news-moderation.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/rules/docs/news-moderation.txt 2009-08-21 22:07:35 +0000
@@ -9,7 +9,8 @@
circuitous route, but it works nonetheless by holding all messages posted
directly to the mailing list.
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> rule = config.rules['news-moderation']
>>> print rule.name
news-moderation
=== modified file 'src/mailman/rules/docs/no-subject.txt'
--- src/mailman/rules/docs/no-subject.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/rules/docs/no-subject.txt 2009-08-21 22:07:35 +0000
@@ -5,7 +5,8 @@
This rule matches if the message has no Subject header, or if the header is
the empty string when stripped.
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> rule = config.rules['no-subject']
>>> print rule.name
no-subject
=== modified file 'src/mailman/rules/docs/recipients.txt'
--- src/mailman/rules/docs/recipients.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/rules/docs/recipients.txt 2009-08-21 22:07:35 +0000
@@ -5,7 +5,8 @@
The 'max-recipients' rule matches when there are more than the maximum allowed
number of explicit recipients addressed by the message.
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> rule = config.rules['max-recipients']
>>> print rule.name
max-recipients
=== modified file 'src/mailman/rules/docs/rules.txt'
--- src/mailman/rules/docs/rules.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/rules/docs/rules.txt 2009-08-21 22:07:35 +0000
@@ -47,7 +47,8 @@
`check()` method. This returns a boolean indicating whether the rule was
matched or not.
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> msg = message_from_string("""\
... From: [email protected]
...
=== modified file 'src/mailman/rules/docs/suspicious.txt'
--- src/mailman/rules/docs/suspicious.txt 2009-07-19 02:31:45 +0000
+++ src/mailman/rules/docs/suspicious.txt 2009-08-21 22:07:35 +0000
@@ -6,7 +6,8 @@
particular regular expression. This mostly historical feature is fairly
confusing to users, and the list attribute that controls this is misnamed.
- >>> mlist = config.db.list_manager.create('[email protected]')
+ >>> from mailman.app.lifecycle import create_list
+ >>> mlist = create_list('[email protected]')
>>> rule = config.rules['suspicious-header']
>>> print rule.name
suspicious-header
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org