summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Mailman/Cgi/admin.py2
-rw-r--r--Mailman/Cgi/admindb.py95
-rw-r--r--Mailman/Cgi/confirm.py32
-rw-r--r--Mailman/MailList.py9
-rw-r--r--Mailman/bin/bounces.py4
-rw-r--r--Mailman/bin/confirm.py5
-rw-r--r--Mailman/bin/inject.py12
-rw-r--r--Mailman/bin/join.py5
-rw-r--r--Mailman/bin/leave.py4
-rw-r--r--Mailman/bin/owner.py7
-rw-r--r--Mailman/bin/post.py5
-rw-r--r--Mailman/bin/request.py5
-rw-r--r--Mailman/bin/unshunt.py12
-rw-r--r--Mailman/bin/version.py10
14 files changed, 110 insertions, 97 deletions
diff --git a/Mailman/Cgi/admin.py b/Mailman/Cgi/admin.py
index ed033d49a..82031beb6 100644
--- a/Mailman/Cgi/admin.py
+++ b/Mailman/Cgi/admin.py
@@ -61,7 +61,7 @@ def main():
# Get the list object
listname = parts[0].lower()
try:
- mlist = MailList.MailList(listname, lock=0)
+ mlist = MailList.MailList(listname, lock=False)
except Errors.MMListError, e:
# Avoid cross-site scripting attacks
safelistname = Utils.websafe(listname)
diff --git a/Mailman/Cgi/admindb.py b/Mailman/Cgi/admindb.py
index 580f21ae2..188aabd1c 100644
--- a/Mailman/Cgi/admindb.py
+++ b/Mailman/Cgi/admindb.py
@@ -29,16 +29,15 @@ import logging
from urllib import quote_plus, unquote_plus
from Mailman import Errors
-from Mailman import i18n
from Mailman import MailList
from Mailman import Message
-from Mailman import mm_cfg
from Mailman import Utils
-
+from Mailman import i18n
from Mailman.Cgi import Auth
from Mailman.Handlers.Moderate import ModeratedMemberPost
-from Mailman.htmlformat import *
from Mailman.ListAdmin import readMessage
+from Mailman.configuration import config
+from Mailman.htmlformat import *
EMPTYSTRING = ''
NL = '\n'
@@ -46,7 +45,7 @@ NL = '\n'
# Set up i18n. Until we know which list is being requested, we use the
# server's default.
_ = i18n._
-i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
+i18n.set_language(config.DEFAULT_SERVER_LANGUAGE)
EXCERPT_HEIGHT = 10
EXCERPT_WIDTH = 76
@@ -100,9 +99,9 @@ def main():
# Make sure the user is authorized to see this page.
cgidata = cgi.FieldStorage(keep_blank_values=1)
- if not mlist.WebAuthenticate((mm_cfg.AuthListAdmin,
- mm_cfg.AuthListModerator,
- mm_cfg.AuthSiteAdmin),
+ if not mlist.WebAuthenticate((config.AuthListAdmin,
+ config.AuthListModerator,
+ config.AuthSiteAdmin),
cgidata.getvalue('adminpw', '')):
if cgidata.has_key('adminpw'):
# This is a re-authorization attempt
@@ -260,7 +259,7 @@ def main():
def handle_no_list(msg=''):
# Print something useful if no list was given.
doc = Document()
- doc.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
+ doc.set_language(config.DEFAULT_SERVER_LANGUAGE)
header = _('Mailman Administrative Database Error')
doc.SetTitle(header)
@@ -298,7 +297,7 @@ def show_pending_subs(mlist, form):
for addr, ids in byaddrs.items():
# Eliminate duplicates
for id in ids[1:]:
- mlist.HandleRequest(id, mm_cfg.DISCARD)
+ mlist.HandleRequest(id, config.DISCARD)
id = ids[0]
time, addr, fullname, passwd, digest, lang = mlist.GetRecord(id)
fullname = Utils.uncanonstr(fullname, mlist.preferred_language)
@@ -306,10 +305,10 @@ def show_pending_subs(mlist, form):
_('Approve'),
_('Reject'),
_('Discard')),
- values=(mm_cfg.DEFER,
- mm_cfg.SUBSCRIBE,
- mm_cfg.REJECT,
- mm_cfg.DISCARD),
+ values=(config.DEFER,
+ config.SUBSCRIBE,
+ config.REJECT,
+ config.DISCARD),
checked=0).Format()
if addr not in mlist.ban_list:
radio += '<br>' + CheckBox('ban-%d' % id, 1).Format() + \
@@ -349,7 +348,7 @@ def show_pending_unsubs(mlist, form):
for addr, ids in byaddrs.items():
# Eliminate duplicates
for id in ids[1:]:
- mlist.HandleRequest(id, mm_cfg.DISCARD)
+ mlist.HandleRequest(id, config.DISCARD)
id = ids[0]
addr = mlist.GetRecord(id)
try:
@@ -357,7 +356,7 @@ def show_pending_unsubs(mlist, form):
except Errors.NotAMemberError:
# They must have been unsubscribed elsewhere, so we can just
# discard this record.
- mlist.HandleRequest(id, mm_cfg.DISCARD)
+ mlist.HandleRequest(id, config.DISCARD)
continue
num += 1
table.AddRow(['%s<br><em>%s</em>' % (addr, fullname),
@@ -365,10 +364,10 @@ def show_pending_unsubs(mlist, form):
_('Approve'),
_('Reject'),
_('Discard')),
- values=(mm_cfg.DEFER,
- mm_cfg.UNSUBSCRIBE,
- mm_cfg.REJECT,
- mm_cfg.DISCARD),
+ values=(config.DEFER,
+ config.UNSUBSCRIBE,
+ config.REJECT,
+ config.DISCARD),
checked=0),
TextBox('comment-%d' % id, size=45)
])
@@ -405,7 +404,7 @@ def show_helds_overview(mlist, form):
btns = hacky_radio_buttons(
'senderaction-' + qsender,
(_('Defer'), _('Accept'), _('Reject'), _('Discard')),
- (mm_cfg.DEFER, mm_cfg.APPROVE, mm_cfg.REJECT, mm_cfg.DISCARD),
+ (config.DEFER, config.APPROVE, config.REJECT, config.DISCARD),
(1, 0, 0, 0))
left.AddRow([btns])
left.AddCellInfo(left.GetCurrentRowIndex(), 0, colspan=2)
@@ -432,7 +431,7 @@ def show_helds_overview(mlist, form):
# the sender filters, then give the admin a chance to add this sender
# to one of the filters.
if mlist.isMember(sender):
- if mlist.getMemberOption(sender, mm_cfg.Moderate):
+ if mlist.getMemberOption(sender, config.Moderate):
left.AddRow([
CheckBox('senderclearmodp-' + qsender, 1).Format() +
'&nbsp;' +
@@ -455,7 +454,7 @@ def show_helds_overview(mlist, form):
btns = hacky_radio_buttons(
'senderfilter-' + qsender,
(_('Accepts'), _('Holds'), _('Rejects'), _('Discards')),
- (mm_cfg.ACCEPT, mm_cfg.HOLD, mm_cfg.REJECT, mm_cfg.DISCARD),
+ (config.ACCEPT, config.HOLD, config.REJECT, config.DISCARD),
(0, 0, 0, 1))
left.AddRow([btns])
left.AddCellInfo(left.GetCurrentRowIndex(), 0, colspan=2)
@@ -481,12 +480,12 @@ def show_helds_overview(mlist, form):
# BAW: This is really the size of the message pickle, which should
# be close, but won't be exact. Sigh, good enough.
try:
- size = os.path.getsize(os.path.join(mm_cfg.DATA_DIR, filename))
+ size = os.path.getsize(os.path.join(config.DATA_DIR, filename))
except OSError, e:
if e.errno <> errno.ENOENT: raise
# This message must have gotten lost, i.e. it's already been
# handled by the time we got here.
- mlist.HandleRequest(id, mm_cfg.DISCARD)
+ mlist.HandleRequest(id, config.DISCARD)
continue
dispsubj = Utils.oneline(
subject, Utils.GetCharSet(mlist.preferred_language))
@@ -571,7 +570,7 @@ def show_post_requests(mlist, id, info, total, count, form):
# an actual object, which will be easier to deal with. We probably could
# just do raw reads on the file.
try:
- msg = readMessage(os.path.join(mm_cfg.DATA_DIR, filename))
+ msg = readMessage(os.path.join(config.DATA_DIR, filename))
except IOError, e:
if e.errno <> errno.ENOENT:
raise
@@ -579,7 +578,7 @@ def show_post_requests(mlist, id, info, total, count, form):
form.AddItem('<p>')
# BAW: kludge to remove id from requests.db.
try:
- mlist.HandleRequest(id, mm_cfg.DISCARD)
+ mlist.HandleRequest(id, config.DISCARD)
except Errors.LostHeldMessage:
pass
return
@@ -590,7 +589,7 @@ def show_post_requests(mlist, id, info, total, count, form):
form.AddItem('<p>')
# BAW: kludge to remove id from requests.db.
try:
- mlist.HandleRequest(id, mm_cfg.DISCARD)
+ mlist.HandleRequest(id, config.DISCARD)
except Errors.LostHeldMessage:
pass
return
@@ -598,7 +597,7 @@ def show_post_requests(mlist, id, info, total, count, form):
lines = []
chars = 0
# A negative value means, include the entire message regardless of size
- limit = mm_cfg.ADMINDB_PAGE_TEXT_LIMIT
+ limit = config.ADMINDB_PAGE_TEXT_LIMIT
for line in email.Iterators.body_line_iterator(msg):
lines.append(line)
chars += len(line)
@@ -606,7 +605,7 @@ def show_post_requests(mlist, id, info, total, count, form):
break
# Negative values mean display the entire message, regardless of size
if limit > 0:
- body = EMPTYSTRING.join(lines)[:mm_cfg.ADMINDB_PAGE_TEXT_LIMIT]
+ body = EMPTYSTRING.join(lines)[:config.ADMINDB_PAGE_TEXT_LIMIT]
else:
body = EMPTYSTRING.join(lines)
# Get message charset and try encode in list charset
@@ -639,10 +638,10 @@ def show_post_requests(mlist, id, info, total, count, form):
buttons = Table(cellspacing="5", cellpadding="0")
buttons.AddRow(map(lambda x, s='&nbsp;'*5: s+x+s,
(_('Defer'), _('Approve'), _('Reject'), _('Discard'))))
- buttons.AddRow([Center(RadioButton(id, mm_cfg.DEFER, 1)),
- Center(RadioButton(id, mm_cfg.APPROVE, 0)),
- Center(RadioButton(id, mm_cfg.REJECT, 0)),
- Center(RadioButton(id, mm_cfg.DISCARD, 0)),
+ buttons.AddRow([Center(RadioButton(id, config.DEFER, 1)),
+ Center(RadioButton(id, config.APPROVE, 0)),
+ Center(RadioButton(id, config.REJECT, 0)),
+ Center(RadioButton(id, config.DISCARD, 0)),
])
t.AddRow([Bold(_('Action:')), buttons])
t.AddCellInfo(row+3, col-1, align='right')
@@ -699,13 +698,13 @@ def process_form(mlist, doc, cgidata):
actions = senderactions[sender]
# Handle what to do about all this sender's held messages
try:
- action = int(actions.get('senderaction', mm_cfg.DEFER))
+ action = int(actions.get('senderaction', config.DEFER))
except ValueError:
- action = mm_cfg.DEFER
- if action == mm_cfg.DEFER and discardalldefersp:
- action = mm_cfg.DISCARD
- if action in (mm_cfg.DEFER, mm_cfg.APPROVE,
- mm_cfg.REJECT, mm_cfg.DISCARD):
+ action = config.DEFER
+ if action == config.DEFER and discardalldefersp:
+ action = config.DISCARD
+ if action in (config.DEFER, config.APPROVE,
+ config.REJECT, config.DISCARD):
preserve = actions.get('senderpreserve', 0)
forward = actions.get('senderforward', 0)
forwardaddr = actions.get('senderforwardto', '')
@@ -728,19 +727,19 @@ def process_form(mlist, doc, cgidata):
except ValueError:
# Bogus form
which = 'ignore'
- if which == mm_cfg.ACCEPT:
+ if which == config.ACCEPT:
mlist.accept_these_nonmembers.append(sender)
- elif which == mm_cfg.HOLD:
+ elif which == config.HOLD:
mlist.hold_these_nonmembers.append(sender)
- elif which == mm_cfg.REJECT:
+ elif which == config.REJECT:
mlist.reject_these_nonmembers.append(sender)
- elif which == mm_cfg.DISCARD:
+ elif which == config.DISCARD:
mlist.discard_these_nonmembers.append(sender)
# Otherwise, it's a bogus form, so ignore it
# And now see if we're to clear the member's moderation flag.
if actions.get('senderclearmodp', 0):
try:
- mlist.setMemberOption(sender, mm_cfg.Moderate, 0)
+ mlist.setMemberOption(sender, config.Moderate, 0)
except Errors.NotAMemberError:
# This person's not a member any more. Oh well.
pass
@@ -760,9 +759,9 @@ def process_form(mlist, doc, cgidata):
request_id = int(k)
except ValueError:
continue
- if v not in (mm_cfg.DEFER, mm_cfg.APPROVE, mm_cfg.REJECT,
- mm_cfg.DISCARD, mm_cfg.SUBSCRIBE, mm_cfg.UNSUBSCRIBE,
- mm_cfg.ACCEPT, mm_cfg.HOLD):
+ if v not in (config.DEFER, config.APPROVE, config.REJECT,
+ config.DISCARD, config.SUBSCRIBE, config.UNSUBSCRIBE,
+ config.ACCEPT, config.HOLD):
continue
# Get the action comment and reasons if present.
commentkey = 'comment-%d' % request_id
diff --git a/Mailman/Cgi/confirm.py b/Mailman/Cgi/confirm.py
index 352cb81ad..783f2053d 100644
--- a/Mailman/Cgi/confirm.py
+++ b/Mailman/Cgi/confirm.py
@@ -20,19 +20,19 @@
import cgi
import time
import signal
+import logging
from Mailman import Errors
-from Mailman import i18n
from Mailman import MailList
-from Mailman import mm_cfg
from Mailman import Pending
-
-from Mailman.htmlformat import *
+from Mailman import i18n
from Mailman.UserDesc import UserDesc
+from Mailman.configuration import config
+from Mailman.htmlformat import *
# Set up i18n
_ = i18n._
-i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
+i18n.set_language(config.DEFAULT_SERVER_LANGUAGE)
log = logging.getLogger('mailman.error')
@@ -40,7 +40,7 @@ log = logging.getLogger('mailman.error')
def main():
doc = Document()
- doc.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
+ doc.set_language(config.DEFAULT_SERVER_LANGUAGE)
parts = Utils.GetPathPieces()
if not parts or len(parts) < 1:
@@ -85,7 +85,7 @@ def main():
ask_for_cookie(mlist, doc)
return
- days = int(mm_cfg.PENDING_REQUEST_LIFE / mm_cfg.days(1) + 0.5)
+ days = int(config.PENDING_REQUEST_LIFE / config.days(1) + 0.5)
confirmurl = mlist.GetScriptURL('confirm', absolute=1)
# Avoid cross-site scripting attacks
safecookie = Utils.websafe(cookie)
@@ -193,7 +193,7 @@ def ask_for_cookie(mlist, doc, extra=''):
table = Table(border=0, width='100%')
table.AddRow([Center(Bold(FontAttr(title, size='+1')))])
table.AddCellInfo(table.GetCurrentRowIndex(), 0,
- colspan=2, bgcolor=mm_cfg.WEB_HEADER_COLOR)
+ colspan=2, bgcolor=config.WEB_HEADER_COLOR)
if extra:
table.AddRow([Bold(FontAttr(extra, size='+1'))])
@@ -231,7 +231,7 @@ def subscription_prompt(mlist, doc, cookie, userdesc):
table = Table(border=0, width='100%')
table.AddRow([Center(Bold(FontAttr(title, size='+1')))])
table.AddCellInfo(table.GetCurrentRowIndex(), 0,
- colspan=2, bgcolor=mm_cfg.WEB_HEADER_COLOR)
+ colspan=2, bgcolor=config.WEB_HEADER_COLOR)
listname = mlist.real_name
# This is the normal, no-confirmation required results text.
@@ -458,7 +458,7 @@ def unsubscription_prompt(mlist, doc, cookie, addr):
table = Table(border=0, width='100%')
table.AddRow([Center(Bold(FontAttr(title, size='+1')))])
table.AddCellInfo(table.GetCurrentRowIndex(), 0,
- colspan=2, bgcolor=mm_cfg.WEB_HEADER_COLOR)
+ colspan=2, bgcolor=config.WEB_HEADER_COLOR)
listname = mlist.real_name
fullname = mlist.getMemberName(addr)
@@ -554,7 +554,7 @@ def addrchange_prompt(mlist, doc, cookie, oldaddr, newaddr, globally):
table = Table(border=0, width='100%')
table.AddRow([Center(Bold(FontAttr(title, size='+1')))])
table.AddCellInfo(table.GetCurrentRowIndex(), 0,
- colspan=2, bgcolor=mm_cfg.WEB_HEADER_COLOR)
+ colspan=2, bgcolor=config.WEB_HEADER_COLOR)
listname = mlist.real_name
fullname = mlist.getMemberName(oldaddr)
@@ -601,7 +601,7 @@ def heldmsg_cancel(mlist, doc, cookie):
table = Table(border=0, width='100%')
table.AddRow([Center(Bold(FontAttr(title, size='+1')))])
table.AddCellInfo(table.GetCurrentRowIndex(), 0,
- bgcolor=mm_cfg.WEB_HEADER_COLOR)
+ bgcolor=config.WEB_HEADER_COLOR)
# Expunge this record from the pending database.
expunge(mlist, cookie)
table.AddRow([_('''Okay, the list moderator will still have the
@@ -629,7 +629,7 @@ def heldmsg_confirm(mlist, doc, cookie):
i18n.set_language(lang)
doc.set_language(lang)
# Discard the message
- mlist.HandleRequest(id, mm_cfg.DISCARD,
+ mlist.HandleRequest(id, config.DISCARD,
_('Sender discarded message via web.'))
except Errors.LostHeldMessage:
bad_confirmation(doc, _('''The held message with the Subject:
@@ -660,7 +660,7 @@ def heldmsg_prompt(mlist, doc, cookie, id):
table = Table(border=0, width='100%')
table.AddRow([Center(Bold(FontAttr(title, size='+1')))])
table.AddCellInfo(table.GetCurrentRowIndex(), 0,
- colspan=2, bgcolor=mm_cfg.WEB_HEADER_COLOR)
+ colspan=2, bgcolor=config.WEB_HEADER_COLOR)
# Blarg. The list must be locked in order to interact with the ListAdmin
# database, even for read-only. See the comment in admin.py about the
# need for the signal handler.
@@ -773,7 +773,7 @@ def reenable_prompt(mlist, doc, cookie, list, member):
table = Table(border=0, width='100%')
table.AddRow([Center(Bold(FontAttr(title, size='+1')))])
table.AddCellInfo(table.GetCurrentRowIndex(), 0,
- colspan=2, bgcolor=mm_cfg.WEB_HEADER_COLOR)
+ colspan=2, bgcolor=config.WEB_HEADER_COLOR)
lang = mlist.getMemberLanguage(member)
i18n.set_language(lang)
@@ -793,7 +793,7 @@ def reenable_prompt(mlist, doc, cookie, list, member):
time.localtime(time.mktime(info.date + (0,)*6)))
daysleft = int(info.noticesleft *
mlist.bounce_you_are_disabled_warnings_interval /
- mm_cfg.days(1))
+ config.days(1))
# BAW: for consistency this should be changed to 'fullname' or the above
# 'fullname's should be changed to 'username'. Don't want to muck with
# the i18n catalogs though.
diff --git a/Mailman/MailList.py b/Mailman/MailList.py
index 9fa5806de..710ec1bd4 100644
--- a/Mailman/MailList.py
+++ b/Mailman/MailList.py
@@ -262,11 +262,12 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
acct, host = tuple(member.split('@'))
return "%s%s@%s" % (acct, self.umbrella_member_suffix, host)
- def GetScriptURL(self, scriptname, absolute=0):
- return Utils.ScriptURL(scriptname, self.web_page_url, absolute) + \
- '/' + self.internal_name()
+ def GetScriptURL(self, scriptname, absolute=False):
+ return '%s/%s' % (
+ Utils.ScriptURL(scriptname, self.web_page_url, absolute),
+ self.fqdn_listname)
- def GetOptionsURL(self, user, obscure=0, absolute=0):
+ def GetOptionsURL(self, user, obscure=0, absolute=False):
url = self.GetScriptURL('options', absolute)
if obscure:
user = Utils.ObscureEmail(user)
diff --git a/Mailman/bin/bounces.py b/Mailman/bin/bounces.py
index b37f8a437..08de2844f 100644
--- a/Mailman/bin/bounces.py
+++ b/Mailman/bin/bounces.py
@@ -28,8 +28,8 @@ import logging
from Mailman import Utils
from Mailman import loginit
-from Mailman import mm_cfg
from Mailman.Queue.sbcache import get_switchboard
+from Mailman.configuration import config
from Mailman.i18n import _
__i18n_templates__ = True
@@ -54,7 +54,7 @@ def main():
# some MTAs have a hard limit to the time a filter prog can run. Postfix
# is a good example; if the limit is hit, the proc is SIGKILL'd giving us
# no chance to save the message.
- bounceq = get_switchboard(mm_cfg.BOUNCEQUEUE_DIR)
+ bounceq = get_switchboard(config.BOUNCEQUEUE_DIR)
bounceq.enqueue(sys.stdin.read(), listname=listname, _plaintext=True)
diff --git a/Mailman/bin/confirm.py b/Mailman/bin/confirm.py
index b51264d1a..fc971a5e0 100644
--- a/Mailman/bin/confirm.py
+++ b/Mailman/bin/confirm.py
@@ -28,8 +28,8 @@ import logging
from Mailman import Utils
from Mailman import loginit
-from Mailman import mm_cfg
from Mailman.Queue.sbcache import get_switchboard
+from Mailman.configuration import config
from Mailman.i18n import _
__i18n_templates__ = True
@@ -37,6 +37,7 @@ __i18n_templates__ = True
def main():
+ config.load()
# Setup logging to stderr stream and error log.
loginit.initialize(propagate=True)
log = logging.getLogger('mailman.error')
@@ -54,7 +55,7 @@ def main():
# some MTAs have a hard limit to the time a filter prog can run. Postfix
# is a good example; if the limit is hit, the proc is SIGKILL'd giving us
# no chance to save the message.
- cmdq = get_switchboard(mm_cfg.CMDQUEUE_DIR)
+ cmdq = get_switchboard(config.CMDQUEUE_DIR)
cmdq.enqueue(sys.stdin.read(), listname=listname,
toconfirm=True, _plaintext=True)
diff --git a/Mailman/bin/inject.py b/Mailman/bin/inject.py
index 1b25ec1bf..80c495c03 100644
--- a/Mailman/bin/inject.py
+++ b/Mailman/bin/inject.py
@@ -21,7 +21,8 @@ import optparse
from Mailman import Post
from Mailman import Utils
-from Mailman import mm_cfg
+from Mailman import Version
+from Mailman.configuration import config
from Mailman.i18n import _
__i18n_templates__ = True
@@ -29,7 +30,7 @@ __i18n_templates__ = True
def parseargs():
- parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION,
+ parser = optparse.OptionParser(version=Version.MAILMAN_VERSION,
usage=_("""\
%prog [options] [filename]
@@ -45,6 +46,8 @@ The name of the list to inject this message to. Required."""))
The name of the queue to inject the message to. The queuename must be one of
the directories inside the qfiles directory. If omitted, the incoming queue
is used."""))
+ parser.add_option('-C', '--config',
+ help=_('Alternative configuration file to use'))
opts, args = parser.parse_args()
if len(args) > 1:
parser.print_help()
@@ -60,15 +63,16 @@ is used."""))
def main():
parser, opts, args = parseargs()
+ config.load(opts.config)
if opts.queue:
- qdir = os.path.join(mm_cfg.QUEUE_DIR, opts.queue)
+ qdir = os.path.join(config.QUEUE_DIR, opts.queue)
if not os.path.isdir(qdir):
parser.print_help()
print >> sys.stderr, _('Bad queue directory: $qdir')
sys.exit(1)
else:
- qdir = mm_cfg.INQUEUE_DIR
+ qdir = config.INQUEUE_DIR
if not Utils.list_exists(opts.listname):
parser.print_help()
diff --git a/Mailman/bin/join.py b/Mailman/bin/join.py
index 2ea07419c..a3b5183ee 100644
--- a/Mailman/bin/join.py
+++ b/Mailman/bin/join.py
@@ -28,8 +28,8 @@ import logging
from Mailman import Utils
from Mailman import loginit
-from Mailman import mm_cfg
from Mailman.Queue.sbcache import get_switchboard
+from Mailman.configuration import config
from Mailman.i18n import _
__i18n_templates__ = True
@@ -37,6 +37,7 @@ __i18n_templates__ = True
def main():
+ config.load()
# Setup logging to stderr stream and error log.
loginit.initialize(propagate=True)
log = logging.getLogger('mailman.error')
@@ -54,7 +55,7 @@ def main():
# some MTAs have a hard limit to the time a filter prog can run. Postfix
# is a good example; if the limit is hit, the proc is SIGKILL'd giving us
# no chance to save the message.
- cmdq = get_switchboard(mm_cfg.CMDQUEUE_DIR)
+ cmdq = get_switchboard(config.CMDQUEUE_DIR)
cmdq.enqueue(sys.stdin.read(), listname=listname,
tojoin=True, _plaintext=True)
diff --git a/Mailman/bin/leave.py b/Mailman/bin/leave.py
index 9687906de..16c35bb0b 100644
--- a/Mailman/bin/leave.py
+++ b/Mailman/bin/leave.py
@@ -28,8 +28,8 @@ import logging
from Mailman import Utils
from Mailman import loginit
-from Mailman import mm_cfg
from Mailman.Queue.sbcache import get_switchboard
+from Mailman.configuration import config
from Mailman.i18n import _
__i18n_templates__ = True
@@ -54,7 +54,7 @@ def main():
# some MTAs have a hard limit to the time a filter prog can run. Postfix
# is a good example; if the limit is hit, the proc is SIGKILL'd giving us
# no chance to save the message.
- cmdq = get_switchboard(mm_cfg.CMDQUEUE_DIR)
+ cmdq = get_switchboard(config.CMDQUEUE_DIR)
cmdq.enqueue(sys.stdin.read(), listname=listname,
toleave=True, _plaintext=True)
diff --git a/Mailman/bin/owner.py b/Mailman/bin/owner.py
index f1eb7ce62..b400b1cf2 100644
--- a/Mailman/bin/owner.py
+++ b/Mailman/bin/owner.py
@@ -31,8 +31,8 @@ import logging
from Mailman import Utils
from Mailman import loginit
-from Mailman import mm_cfg
from Mailman.Queue.sbcache import get_switchboard
+from Mailman.configuration import config
from Mailman.i18n import _
__i18n_templates__ = True
@@ -40,6 +40,7 @@ __i18n_templates__ = True
def main():
+ config.load()
# Setup logging to stderr stream and error log.
loginit.initialize(propagate=True)
log = logging.getLogger('mailman.error')
@@ -56,11 +57,11 @@ def main():
# incoming queue because we need some processing done on the message. The
# processing is minimal though, so craft our own pipeline, expressly for
# the purpose of delivering to the list owners.
- inq = get_switchboard(mm_cfg.INQUEUE_DIR)
+ inq = get_switchboard(config.INQUEUE_DIR)
inq.enqueue(sys.stdin.read(),
listname=listname,
_plaintext=True,
- pipeline=mm_cfg.OWNER_PIPELINE,
+ pipeline=config.OWNER_PIPELINE,
toowner=True)
diff --git a/Mailman/bin/post.py b/Mailman/bin/post.py
index aaf943e8e..f2d7c61d4 100644
--- a/Mailman/bin/post.py
+++ b/Mailman/bin/post.py
@@ -31,8 +31,8 @@ import logging
from Mailman import Utils
from Mailman import loginit
-from Mailman import mm_cfg
from Mailman.Queue.sbcache import get_switchboard
+from Mailman.configuration import config
from Mailman.i18n import _
__i18n_templates__ = True
@@ -40,6 +40,7 @@ __i18n_templates__ = True
def main():
+ config.load()
# Setup logging to stderr stream and error log.
loginit.initialize(propagate=True)
log = logging.getLogger('mailman.error')
@@ -61,7 +62,7 @@ def main():
# some MTAs have a hard limit to the time a filter prog can run. Postfix
# is a good example; if the limit is hit, the proc is SIGKILL'd giving us
# no chance to save the message.
- inq = get_switchboard(mm_cfg.INQUEUE_DIR)
+ inq = get_switchboard(config.INQUEUE_DIR)
inq.enqueue(sys.stdin.read(),
listname=listname,
tolist=True, _plaintext=True)
diff --git a/Mailman/bin/request.py b/Mailman/bin/request.py
index 15300537b..c059b8c94 100644
--- a/Mailman/bin/request.py
+++ b/Mailman/bin/request.py
@@ -28,8 +28,8 @@ import logging
from Mailman import Utils
from Mailman import loginit
-from Mailman import mm_cfg
from Mailman.Queue.sbcache import get_switchboard
+from Mailman.configuration import config
from Mailman.i18n import _
__i18n_templates__ = True
@@ -37,6 +37,7 @@ __i18n_templates__ = True
def main():
+ config.load()
# Setup logging to stderr stream and error log.
loginit.initialize(propagate=True)
log = logging.getLogger('mailman.error')
@@ -54,7 +55,7 @@ def main():
# some MTAs have a hard limit to the time a filter prog can run. Postfix
# is a good example; if the limit is hit, the proc is SIGKILL'd giving us
# no chance to save the message.
- cmdq = get_switchboard(mm_cfg.CMDQUEUE_DIR)
+ cmdq = get_switchboard(config.CMDQUEUE_DIR)
cmdq.enqueue(sys.stdin.read(),
listname=listname,
torequest=True,
diff --git a/Mailman/bin/unshunt.py b/Mailman/bin/unshunt.py
index d50571c96..24512d865 100644
--- a/Mailman/bin/unshunt.py
+++ b/Mailman/bin/unshunt.py
@@ -18,8 +18,9 @@
import sys
import optparse
-from Mailman import mm_cfg
+from Mailman import Version
from Mailman.Queue.sbcache import get_switchboard
+from Mailman.configuration import config
from Mailman.i18n import _
__i18n_templates__ = True
@@ -27,13 +28,15 @@ __i18n_templates__ = True
def parseargs():
- parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION,
+ parser = optparse.OptionParser(version=Version.MAILMAN_VERSION,
usage=_("""\
%%prog [options] [directory]
Move a message from the shunt queue to the original queue. Optional
`directory' specifies a directory to dequeue from other than qfiles/shunt.
"""))
+ parser.add_option('-C', '--config',
+ help=_('Alternative configuration file to use'))
opts, args = parser.parse_args()
if len(args) > 1:
parser.print_help()
@@ -45,17 +48,18 @@ Move a message from the shunt queue to the original queue. Optional
def main():
parser, opts, args = parseargs()
+ config.load(opts.config)
if args:
qdir = args[0]
else:
- qdir = mm_cfg.SHUNTQUEUE_DIR
+ qdir = config.SHUNTQUEUE_DIR
sb = get_switchboard(qdir)
sb.recover_backup_files()
for filebase in sb.files():
try:
msg, msgdata = sb.dequeue(filebase)
- whichq = msgdata.get('whichq', mm_cfg.INQUEUE_DIR)
+ whichq = msgdata.get('whichq', config.INQUEUE_DIR)
tosb = get_switchboard(whichq)
tosb.enqueue(msg, msgdata)
except Exception, e:
diff --git a/Mailman/bin/version.py b/Mailman/bin/version.py
index dbf52c656..7b940a230 100644
--- a/Mailman/bin/version.py
+++ b/Mailman/bin/version.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-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
@@ -17,7 +17,7 @@
import optparse
-from Mailman import mm_cfg
+from Mailman import Version
from Mailman.i18n import _
__i18n_templates__ = True
@@ -25,11 +25,11 @@ __i18n_templates__ = True
def parseargs():
- parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION,
+ parser = optparse.OptionParser(version=Version.MAILMAN_VERSION,
usage=_("""\
%prog
-Print the Mailman version an exit."""))
+Print the Mailman version and exit."""))
opts, args = parser.parse_args()
if args:
parser.print_help()
@@ -42,7 +42,7 @@ Print the Mailman version an exit."""))
def main():
parser, opts, args = parseargs()
# Yes, this is kind of silly
- print _('Using Mailman version: $mm_cfg.VERSION')
+ print _('Using Mailman version: $Version.MAILMAN_VERSION')