summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--mailman/Message.py2
-rw-r--r--mailman/app/moderator.py4
-rw-r--r--mailman/app/notifications.py6
-rw-r--r--mailman/docs/domains.txt62
-rw-r--r--mailman/docs/registration.txt17
-rw-r--r--mailman/docs/requests.txt5
-rw-r--r--mailman/queue/docs/runner.txt23
-rw-r--r--mailman/queue/news.py12
8 files changed, 53 insertions, 78 deletions
diff --git a/mailman/Message.py b/mailman/Message.py
index 07d7f15bb..fc890fb51 100644
--- a/mailman/Message.py
+++ b/mailman/Message.py
@@ -287,7 +287,7 @@ class OwnerNotification(UserNotification):
else:
roster = mlist.owners
recips = [address.address for address in roster.addresses]
- sender = config.SITE_OWNER_ADDRESS
+ sender = config.mailman.site_owner
lang = mlist.preferred_language
UserNotification.__init__(self, recips, sender, subject, text, lang)
# Hack the To header to look like it's going to the -owner address
diff --git a/mailman/app/moderator.py b/mailman/app/moderator.py
index a678f3734..377bbb175 100644
--- a/mailman/app/moderator.py
+++ b/mailman/app/moderator.py
@@ -41,7 +41,6 @@ from mailman.config import config
from mailman.core import errors
from mailman.interfaces import Action, DeliveryMode, RequestType
from mailman.interfaces.member import AlreadySubscribedError
-from mailman.queue import Switchboard
_ = i18n._
@@ -141,8 +140,7 @@ def handle_message(mlist, id, action,
msg.get('message-id', 'n/a'))
# Stick the message back in the incoming queue for further
# processing.
- inq = Switchboard(config.INQUEUE_DIR)
- inq.enqueue(msg, _metadata=msgdata)
+ config.switchboards['in'].enqueue(msg, _metadata=msgdata)
else:
raise AssertionError('Unexpected action: %s' % action)
# Forward the message.
diff --git a/mailman/app/notifications.py b/mailman/app/notifications.py
index d3546ee83..c2f507e2c 100644
--- a/mailman/app/notifications.py
+++ b/mailman/app/notifications.py
@@ -27,10 +27,10 @@ __all__ = [
from email.utils import formataddr
+from mailman import Defaults
from mailman import Message
from mailman import Utils
from mailman import i18n
-from mailman.config import config
from mailman.interfaces.member import DeliveryMode
_ = i18n._
@@ -79,7 +79,7 @@ def send_welcome_message(mlist, address, language, delivery_mode, text=''):
_('Welcome to the "$mlist.real_name" mailing list${digmode}'),
text, language)
msg['X-No-Archive'] = 'yes'
- msg.send(mlist, verp=config.VERP_PERSONALIZED_DELIVERIES)
+ msg.send(mlist, verp=Defaults.VERP_PERSONALIZED_DELIVERIES)
@@ -104,7 +104,7 @@ def send_goodbye_message(mlist, address, language):
address, mlist.bounces_address,
_('You have been unsubscribed from the $mlist.real_name mailing list'),
goodbye, language)
- msg.send(mlist, verp=config.VERP_PERSONALIZED_DELIVERIES)
+ msg.send(mlist, verp=Defaults.VERP_PERSONALIZED_DELIVERIES)
diff --git a/mailman/docs/domains.txt b/mailman/docs/domains.txt
index d2980cd05..b71689520 100644
--- a/mailman/docs/domains.txt
+++ b/mailman/docs/domains.txt
@@ -2,54 +2,16 @@ Domains
=======
Domains are how Mailman interacts with email host names and web host names.
-Generally, new domains are registered in the mailman.cfg configuration file by
-calling the add_domain() method.
+Generally, new domains are registered in the mailman.cfg configuration file.
+We simulate that here by pushing new configurations.
-At a minimum, the email host name must be specified.
-
- >>> config.add_domain('example.net')
-
-The domain object can be looked up by email host name.
-
- >>> from zope.interface.verify import verifyObject
- >>> from mailman.interfaces.domain import IDomain
- >>> domain = config.domains['example.net']
- >>> verifyObject(IDomain, domain)
- True
-
- >>> print domain.email_host
- example.net
-
-The base url is calculated by default if not given.
-
- >>> print domain.base_url
- http://example.net
-
-There is no description by default.
-
- >>> print domain.description
- None
-
-By default, the contact address is the domain's postmaster.
-
- >>> print domain.contact_address
- postmaster@example.net
-
-And the url_host is by default the same as the email host.
-
- >>> print domain.url_host
- example.net
-
-
-Full specification
-------------------
-
-The domain can also be much more fully defined.
-
- >>> config.add_domain(
- ... 'example.org', 'https://mail.example.org',
- ... 'The example domain',
- ... 'postmaster@mail.example.org')
+ >>> config.push('example.org', """
+ ... [domain.example_dot_org]
+ ... email_host: example.org
+ ... base_url: https://mail.example.org
+ ... description: The example domain
+ ... contact_address: postmaster@mail.example.org
+ ... """)
>>> domain = config.domains['example.org']
>>> print domain.email_host
@@ -76,3 +38,9 @@ Confirmation tokens can be added to either the email confirmation address...
>>> print domain.confirm_url('abc')
https://mail.example.org/confirm/abc
+
+
+Clean up
+--------
+
+ >>> config.pop('example.org')
diff --git a/mailman/docs/registration.txt b/mailman/docs/registration.txt
index 752f49672..a91980e0c 100644
--- a/mailman/docs/registration.txt
+++ b/mailman/docs/registration.txt
@@ -18,7 +18,13 @@ stuff.
Add a domain, which will provide the context for the verification email
message.
- >>> config.add_domain('mail.example.com', 'http://mail.example.com')
+ >>> config.push('mail', """
+ ... [domain.mail_example_dot_com]
+ ... email_host: mail.example.com
+ ... base_url: http://mail.example.com
+ ... contact_address: postmaster@mail.example.com
+ ... """)
+
>>> domain = config.domains['mail.example.com']
Get a registrar by adapting a context to the interface.
@@ -114,8 +120,7 @@ Verification by email
There is also a verification email sitting in the virgin queue now. This
message is sent to the user in order to verify the registered address.
- >>> from mailman.queue import Switchboard
- >>> switchboard = Switchboard(config.VIRGINQUEUE_DIR)
+ >>> switchboard = config.switchboards['virgin']
>>> len(switchboard.files)
1
>>> filebase = switchboard.files[0]
@@ -350,3 +355,9 @@ But after confirmation, he is.
>>> print mlist.members.get_member(u'fred.person@example.com')
<Member: Fred Person <fred.person@example.com>
on alpha@example.com as MemberRole.member>
+
+
+Clean up
+--------
+
+ >>> config.pop('mail')
diff --git a/mailman/docs/requests.txt b/mailman/docs/requests.txt
index 1e1347ed7..c67a7e06e 100644
--- a/mailman/docs/requests.txt
+++ b/mailman/docs/requests.txt
@@ -16,8 +16,7 @@ Here is a helper function for printing out held requests.
And another helper for displaying messages in the virgin queue.
- >>> from mailman.queue import Switchboard
- >>> virginq = Switchboard(config.VIRGINQUEUE_DIR)
+ >>> virginq = config.switchboards['virgin']
>>> def dequeue(whichq=None, expected_count=1):
... if whichq is None:
... whichq = virginq
@@ -302,7 +301,7 @@ indicates that the message has been approved.
>>> id_3 = moderator.hold_message(mlist, msg, msgdata, 'Needs approval')
>>> moderator.handle_message(mlist, id_3, Action.accept)
- >>> inq = Switchboard(config.INQUEUE_DIR)
+ >>> inq = config.switchboards['in']
>>> qmsg, qdata = dequeue(inq)
>>> print qmsg.as_string()
From: aperson@example.org
diff --git a/mailman/queue/docs/runner.txt b/mailman/queue/docs/runner.txt
index 70bab6539..db493110c 100644
--- a/mailman/queue/docs/runner.txt
+++ b/mailman/queue/docs/runner.txt
@@ -14,20 +14,21 @@ The basic architecture of qrunner is implemented in the base class that all
runners inherit from. This base class implements a .run() method that runs
continuously in a loop until the .stop() method is called.
- >>> import os
- >>> from mailman.queue import Runner, Switchboard
>>> mlist = config.db.list_manager.create(u'_xtest@example.com')
>>> mlist.preferred_language = u'en'
-Here is a very simple derived qrunner class. The class attribute QDIR tells
-the qrunner which queue directory it is responsible for. Derived classes
-should also implement various methods to provide the special functionality.
-This is about as simple as a qrunner can be.
+Here is a very simple derived qrunner class. Queue runners use a
+configuration section in the configuration files to determine run
+characteristics, such as the queue directory to use. Here we push a
+configuration section for the test runner.
- >>> queue_directory = os.path.join(config.QUEUE_DIR, 'test')
+ >>> config.push('test-runner', """
+ ... [qrunner.test]
+ ... max_restarts: 1
+ ... """)
+
+ >>> from mailman.queue import Runner
>>> class TestableRunner(Runner):
- ... QDIR = queue_directory
- ...
... def _dispose(self, mlist, msg, msgdata):
... self.msg = msg
... self.msgdata = msgdata
@@ -39,8 +40,7 @@ This is about as simple as a qrunner can be.
... def _snooze(self, filecnt):
... return
- >>> runner = TestableRunner()
- >>> switchboard = Switchboard(queue_directory)
+ >>> runner = TestableRunner('test')
This qrunner doesn't do much except run once, storing the message and metadata
on instance variables.
@@ -51,6 +51,7 @@ on instance variables.
...
... A test message.
... """)
+ >>> switchboard = config.switchboards['test']
>>> filebase = switchboard.enqueue(msg, listname=mlist.fqdn_listname,
... foo='yes', bar='no')
>>> runner.run()
diff --git a/mailman/queue/news.py b/mailman/queue/news.py
index 70ffae71b..a64afae18 100644
--- a/mailman/queue/news.py
+++ b/mailman/queue/news.py
@@ -28,8 +28,8 @@ from email.utils import getaddresses, make_msgid
COMMASPACE = ', '
+from mailman import Defaults
from mailman import Utils
-from mailman.config import config
from mailman.interfaces import NewsModeration
from mailman.queue import Runner
@@ -51,8 +51,6 @@ mcre = re.compile(r"""
class NewsRunner(Runner):
- QDIR = config.NEWSQUEUE_DIR
-
def _dispose(self, mlist, msg, msgdata):
# Make sure we have the most up-to-date state
mlist.Load()
@@ -67,8 +65,8 @@ class NewsRunner(Runner):
nntp_host, nntp_port = Utils.nntpsplit(mlist.nntp_host)
conn = nntplib.NNTP(nntp_host, nntp_port,
readermode=True,
- user=config.NNTP_USERNAME,
- password=config.NNTP_PASSWORD)
+ user=Defaults.NNTP_USERNAME,
+ password=Defaults.NNTP_PASSWORD)
conn.post(fp)
except nntplib.error_temp, e:
log.error('(NNTPDirect) NNTP error for list "%s": %s',
@@ -150,9 +148,9 @@ def prepare_message(mlist, msg, msgdata):
# woon't completely sanitize the message, but it will eliminate the bulk
# of the rejections based on message headers. The NNTP server may still
# reject the message because of other problems.
- for header in config.NNTP_REMOVE_HEADERS:
+ for header in Defaults.NNTP_REMOVE_HEADERS:
del msg[header]
- for header, rewrite in config.NNTP_REWRITE_DUPLICATE_HEADERS:
+ for header, rewrite in Defaults.NNTP_REWRITE_DUPLICATE_HEADERS:
values = msg.get_all(header, [])
if len(values) < 2:
# We only care about duplicates