summaryrefslogtreecommitdiff
path: root/Mailman/MTA/Utils.py
diff options
context:
space:
mode:
authorbwarsaw2006-07-08 17:37:55 +0000
committerbwarsaw2006-07-08 17:37:55 +0000
commitcbef3114de3e80b9436d909b11568858e3a1cf42 (patch)
treef567fe3fbc331fe399b92e93f80068e8995a7821 /Mailman/MTA/Utils.py
parent60b723291e592ff7925e1b15b79161d1cdac5938 (diff)
downloadmailman-cbef3114de3e80b9436d909b11568858e3a1cf42.tar.gz
mailman-cbef3114de3e80b9436d909b11568858e3a1cf42.tar.zst
mailman-cbef3114de3e80b9436d909b11568858e3a1cf42.zip
Massive conversion process so that Mailman can be run from a user specified
configuration file. While the full conversion is not yet complete, everything that seems to be required to run mailmanctl, qrunner, rmlist, and newlist have been updated. Basically, modules should no longer import mm_cfg, but instead they should import Mailman.configuration.config. The latter is an object that's guaranteed to exist, but not guaranteed to be initialized until some top-level script calls config.load(). The latter should be called with the argument to -C/--config which is a new convention the above scripts have been given. In most cases, where mm_cfg.<variable> is used config.<variable> can be used, but the exceptions are where the default value must be available before config.load() is called. Sometimes you can import Mailman.Default and get the variable from there, but other times the code has to be changed to work around this limitation. Take each on a case-by-case basis. Note that the various directories calculated from VAR_PREFIX, EXEC_PREFIX, and PREFIX are now calculated in config.py, not in Defaults.py. This way a configuration file can override the base directories and everything should work correctly. Other changes here include: - mailmanctl, qrunner, and update are switched to optparse and $-strings, and changed to the mmshell architecture - An etc directory has been added to /usr/local/mailman and a mailman.cfg.sample file is installed there. Sites should now edit an etc/mailman.cfg file to do their configurations, although the mm_cfg file is still honored. The formats of the two files are identical. - list_lists is given the -C/--config option - Some coding style fixes in bin/update, but not extensive - Get rid of nested scope hacks in qrunner.py - A start on getting EmailBase tests working (specifically test_message), although not yet complete.
Diffstat (limited to 'Mailman/MTA/Utils.py')
-rw-r--r--Mailman/MTA/Utils.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/Mailman/MTA/Utils.py b/Mailman/MTA/Utils.py
index 14562de66..ef3df0cb8 100644
--- a/Mailman/MTA/Utils.py
+++ b/Mailman/MTA/Utils.py
@@ -1,25 +1,26 @@
-# Copyright (C) 2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2006 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
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
"""Utilities for list creation/deletion hooks."""
import os
import pwd
-from Mailman import mm_cfg
+from Mailman.configuration import config
@@ -35,7 +36,7 @@ def getusername():
def _makealiases_mailprog(listname):
- wrapper = os.path.join(mm_cfg.WRAPPER_DIR, 'mailman')
+ wrapper = os.path.join(config.WRAPPER_DIR, 'mailman')
# Most of the list alias extensions are quite regular. I.e. if the
# message is delivered to listname-foobar, it will be filtered to a
# program called foobar. There are two exceptions:
@@ -57,7 +58,7 @@ def _makealiases_mailprog(listname):
def _makealiases_maildir(listname):
- maildir = mm_cfg.MAILDIR_DIR
+ maildir = config.MAILDIR_DIR
if not maildir.endswith('/'):
maildir += '/'
# Deliver everything using maildir style. This way there's no mail
@@ -73,7 +74,9 @@ def _makealiases_maildir(listname):
-if mm_cfg.USE_MAILDIR:
+# XXX This won't work if Mailman.MTA.Utils is imported before the
+# configuration is loaded.
+if config.USE_MAILDIR:
makealiases = _makealiases_maildir
else:
makealiases = _makealiases_mailprog