summaryrefslogtreecommitdiff
path: root/Mailman/configuration.py
diff options
context:
space:
mode:
authorbwarsaw2007-01-05 20:57:51 +0000
committerbwarsaw2007-01-05 20:57:51 +0000
commit39fa9eaabcd19919fed0a901d7f3cbc33527d938 (patch)
tree34fcd7e60cb1b7cd9d196615939e6715b575a45c /Mailman/configuration.py
parent9af2533eb89e48683c049c5007737f7e94bbcdc1 (diff)
downloadmailman-39fa9eaabcd19919fed0a901d7f3cbc33527d938.tar.gz
mailman-39fa9eaabcd19919fed0a901d7f3cbc33527d938.tar.zst
mailman-39fa9eaabcd19919fed0a901d7f3cbc33527d938.zip
In HTTPRunner, when we see a KeyboardInterrupt during the serve_forever(),
don't re-raise the exception since that will show up in the log files. Instead just exit with a code equal to SIGTERM. Rework the way qrunners are specified in the mailman.cfg file. Always start the default number of the default set of qrunners, but allow mailman.cfg to delete some with the del_qrunner() function. Rename add_runner() to add_qrunner() and make this actually work <wink>. Both take the shortened qrunner name as the first argument (e.g. 'Arch' instead of 'ArchRunner'). Automatically start the MaildirRunner if USE_MAILDIR = Yes; same goes for LMTPRunner and USE_LMTP = Yes. In both cases, you do not need to also use add_qrunner() in your mailman.cfg file to enable them. You still do need to put "add_qrunner('HTTP')" in your mailman.cfg if you want to enable the wsgi server. This may end up being added to the default set.
Diffstat (limited to 'Mailman/configuration.py')
-rw-r--r--Mailman/configuration.py47
1 files changed, 39 insertions, 8 deletions
diff --git a/Mailman/configuration.py b/Mailman/configuration.py
index 6825d5792..a489025ca 100644
--- a/Mailman/configuration.py
+++ b/Mailman/configuration.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -25,12 +25,24 @@ from Mailman import Errors
_missing = object()
+DEFAULT_QRUNNERS = (
+ 'Arch',
+ 'Bounce',
+ 'Command',
+ 'Incoming',
+ 'News',
+ 'Outgoing',
+ 'Retry',
+ 'Virgin',
+ )
+
class Configuration(object):
def __init__(self):
self.domains = {} # email host -> web host
self._reverse = None
+ self.qrunners = {}
def load(self, filename=None):
# Load the configuration from the named file, or if not given, search
@@ -49,8 +61,13 @@ class Configuration(object):
del ns['__file__']
del ns['__name__']
del ns['__doc__']
- ns['add_domain'] = self.add_domain
- ns['add_runner'] = self.add_runner
+ ns['add_domain'] = self.add_domain
+ ns['add_qrunner'] = self.add_qrunner
+ ns['del_qrunner'] = self.del_qrunner
+ # Set up the default list of qrunners so that the mailman.cfg file may
+ # add or delete them.
+ for name in DEFAULT_QRUNNERS:
+ self.add_qrunner(name)
# Attempt our first choice
path = os.path.abspath(os.path.expanduser(filename))
try:
@@ -61,6 +78,11 @@ class Configuration(object):
# The file didn't exist, so try mm_cfg.py
from Mailman import mm_cfg
ns.update(mm_cfg.__dict__)
+ # Based on values possibly set in mailman.cfg, add additional qrunners
+ if ns['USE_MAILDIR']:
+ self.add_qrunner('Maildir')
+ if ns['USE_LMTP']:
+ self.add_qrunner('LMTP')
# Pull out the defaults
PREFIX = ns['PREFIX']
VAR_PREFIX = ns['VAR_PREFIX']
@@ -141,14 +163,23 @@ class Configuration(object):
self._reverse = dict([(v, k) for k, v in self.domains.items()])
return self._reverse.get(url_host, default)
- def add_runner(self, name, count=1):
+ def add_qrunner(self, name, count=1):
"""Convenient interface for adding additional qrunners.
- name is the qrunner name, and must include the 'Runner' suffix.
- E.g. 'HTTPRunner' or 'LMTPRunner'. count is the number of qrunner
- slices to create, by default, 1.
+ name is the qrunner name and it must not include the 'Runner' suffix.
+ E.g. 'HTTP' or 'LMTP'. count is the number of qrunner slices to
+ create, by default, 1.
+ """
+ name += 'Runner'
+ self.qrunners[name] = count
+
+ def del_qrunner(self, name):
+ """Remove the named qrunner so that it does not start.
+
+ name is the qrunner name and it must not include the 'Runner' suffix.
"""
- self.QRUNNERS.append((name, count))
+ name += 'Runner'
+ self.qrunners.pop(name)
@property
def paths(self):