summaryrefslogtreecommitdiff
path: root/mailman/queue
diff options
context:
space:
mode:
authorBarry Warsaw2008-12-28 19:14:04 -0500
committerBarry Warsaw2008-12-28 19:14:04 -0500
commit7713f04267b9f9245b371c54857ca402a81a3c77 (patch)
treeefb41850451306e453e28274fb225593bbdd6395 /mailman/queue
parent37a69a1b28e0dfbf8357e12798193969accf98ff (diff)
downloadmailman-7713f04267b9f9245b371c54857ca402a81a3c77.tar.gz
mailman-7713f04267b9f9245b371c54857ca402a81a3c77.tar.zst
mailman-7713f04267b9f9245b371c54857ca402a81a3c77.zip
More test repairs.
Diffstat (limited to '')
-rw-r--r--mailman/queue/docs/runner.txt23
-rw-r--r--mailman/queue/news.py12
2 files changed, 17 insertions, 18 deletions
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