summaryrefslogtreecommitdiff
path: root/Mailman/bin/checkdbs.py
diff options
context:
space:
mode:
authormsapiro2006-10-24 03:55:24 +0000
committermsapiro2006-10-24 03:55:24 +0000
commit3256c431e7bf966d3de49e4dc31dd01d57ffb02f (patch)
treee0f32257c2bc73eec34e4ebf2f50c27b0ff23a66 /Mailman/bin/checkdbs.py
parentf0a263b63991efc787bfd870bd7a491c53dce54a (diff)
downloadmailman-3256c431e7bf966d3de49e4dc31dd01d57ffb02f.tar.gz
mailman-3256c431e7bf966d3de49e4dc31dd01d57ffb02f.tar.zst
mailman-3256c431e7bf966d3de49e4dc31dd01d57ffb02f.zip
Updated the mmshell scripts so all use the configuration.py config object
instead of mm_cfg.py. This involved mostly mechanical replacements, but there were a few gotchas to make sure that various calls and assignments that ultimately referenced the config were delayed until after the config was loaded. Updated configuration.py to throw an exception if config.load() is called with a non-existent filename argument. Updated loginit.py to add the fromusenet log used by gate_news.py.
Diffstat (limited to 'Mailman/bin/checkdbs.py')
-rwxr-xr-xMailman/bin/checkdbs.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/Mailman/bin/checkdbs.py b/Mailman/bin/checkdbs.py
index ebcbdb177..a4ff2400a 100755
--- a/Mailman/bin/checkdbs.py
+++ b/Mailman/bin/checkdbs.py
@@ -24,12 +24,11 @@ from email.Charset import Charset
from Mailman import MailList
from Mailman import Message
from Mailman import Utils
+from Mailman import Version
from Mailman import i18n
-from Mailman import mm_cfg
+from Mailman.configuration import config
_ = i18n._
-i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
-
__i18n_templates__ = True
# Work around known problems with some RedHat cron daemons
@@ -42,11 +41,13 @@ now = time.time()
def parseargs():
- parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION,
+ parser = optparse.OptionParser(version=Version.MAILMAN_VERSION,
usage=_("""\
%prog [options]
Check for pending admin requests and mail the list owners if necessary."""))
+ parser.add_option('-C', '--config',
+ help=_('Alternative configuration file to use'))
opts, args = parser.parse_args()
if args:
parser.print_help()
@@ -113,12 +114,12 @@ Cause: $reason"""))
def auto_discard(mlist):
# Discard old held messages
discard_count = 0
- expire = mm_cfg.days(mlist.max_days_to_hold)
+ expire = config.days(mlist.max_days_to_hold)
heldmsgs = mlist.GetHeldMessageIds()
if expire and heldmsgs:
for id in heldmsgs:
if now - mlist.GetRecord(id)[0] > expire:
- mlist.HandleRequest(id, mm_cfg.DISCARD)
+ mlist.HandleRequest(id, config.DISCARD)
discard_count += 1
mlist.Save()
return discard_count
@@ -127,6 +128,9 @@ def auto_discard(mlist):
def main():
opts, args, parser = parseargs()
+ config.load(opts.config)
+
+ i18n.set_language(config.DEFAULT_SERVER_LANGUAGE)
for name in Utils.list_names():
# The list must be locked in order to open the requests database