aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/Makefile.in2
-rw-r--r--bin/reset_pw.py (renamed from bin/reset_pw)8
-rw-r--r--bin/withlist70
-rwxr-xr-xconfigure4
-rw-r--r--configure.in6
5 files changed, 58 insertions, 32 deletions
diff --git a/bin/Makefile.in b/bin/Makefile.in
index daf4faff..518b6088 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -49,7 +49,7 @@ SCRIPTS= mmsitepass newlist rmlist add_members \
list_admins genaliases change_pw mailmanctl qrunner inject \
unshunt fix_url.py convert.py transcheck b4b5-archfix \
list_owners msgfmt.py show_qfiles discard rb-archfix \
- reset_pw
+ reset_pw.py
BUILDDIR= ../build/bin
diff --git a/bin/reset_pw b/bin/reset_pw.py
index d7e5527a..bddc1ace 100644
--- a/bin/reset_pw
+++ b/bin/reset_pw.py
@@ -26,7 +26,7 @@ responsibility to let the users know that their passwords have been changed.
This script is intended to be run as a bin/withlist script, i.e.
-% bin/withlist -l -r reset_pw [options]
+% bin/withlist -l -r reset_pw listname [options]
Options:
-v / --verbose
@@ -72,13 +72,17 @@ def reset_pw(mlist, *args):
if opt in ('-v', '--verbose'):
verbose = True
- listname = mlist.listname()
+ listname = mlist.internal_name()
if verbose:
print _('Changing passwords for list: %(listname)s')
for member in mlist.getMembers():
randompw = Utils.MakeRandomPassword()
mlist.setMemberPassword(member, randompw)
+ if verbose:
+ print _('New password for member %(member)40s: %(randompw)s')
+
+ mlist.Save()
diff --git a/bin/withlist b/bin/withlist
index 345ff39d..02ce3e50 100644
--- a/bin/withlist
+++ b/bin/withlist
@@ -1,6 +1,6 @@
#! @PYTHON@
#
-# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2004 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
@@ -49,12 +49,12 @@ Options:
--run [module.]callable
-r [module.]callable
This can be used to run a script with the opened MailList object.
- This works by attempting to import `module' (which must already be
- accessible on your sys.path), and then calling `callable' from the
- module. callable can be a class or function; it is called with the
- MailList object as the first argument. If additional args are given
- on the command line, they are passed as subsequent positional args to
- the callable.
+ This works by attempting to import `module' (which must be in the
+ directory containing withlist, or already be accessible on your
+ sys.path), and then calling `callable' from the module. callable can
+ be a class or function; it is called with the MailList object as the
+ first argument. If additional args are given on the command line,
+ they are passed as subsequent positional args to the callable.
Note that `module.' is optional; if it is omitted then a module with
the name `callable' will be imported.
@@ -115,24 +115,36 @@ def changepw(mlist, addr, newpasswd):
print 'No address matched:', addr
and run this from the command line:
-%% bin/withlist -l -r changepw mylist somebody@somewhere.org foobar
+ %% bin/withlist -l -r changepw mylist somebody@somewhere.org foobar
"""
+import os
import sys
-import getopt
import code
+import getopt
import paths
-from Mailman import Utils
-from Mailman import MailList
from Mailman import Errors
+from Mailman import MailList
+from Mailman import Utils
from Mailman.i18n import _
+try:
+ True, False
+except NameError:
+ True = 1
+ False = 0
+
+
# `m' will be the MailList object and `r' will be the results of the callable
m = None
r = None
-VERBOSE = 1
-LOCK = 0
+VERBOSE = True
+LOCK = False
+
+
+# Put the bin directory on sys.path -- last
+sys.path.append(os.path.dirname(sys.argv[0]))
@@ -204,23 +216,30 @@ def main():
run = None
interact = None
- all = 0
+ all = False
+ dolist = True
for opt, arg in opts:
if opt in ('-h', '--help'):
usage(0)
elif opt in ('-l', '--lock'):
- LOCK = 1
+ LOCK = True
elif opt in ('-r', '--run'):
run = arg
elif opt in ('-q', '--quiet'):
- VERBOSE = 0
+ VERBOSE = False
elif opt in ('-i', '--interactive'):
- interact = 1
+ interact = True
elif opt in ('-a', '--all'):
- all = 1
+ all = True
if len(args) < 1 and not all:
- usage(1, _('No list name supplied.'))
+ warning = _('No list name supplied.')
+ if interact:
+ # Let them keep going
+ print warning
+ dolist = False
+ else:
+ usage(1, warning)
if all and not run:
usage(1, _('--all requires --run'))
@@ -228,9 +247,9 @@ def main():
# The default for interact is 1 unless -r was given
if interact is None:
if run is None:
- interact = 1
+ interact = True
else:
- interact = 0
+ interact = False
# try to import the module for the callable
func = None
@@ -251,7 +270,7 @@ def main():
if all:
r = [do_list(listname, args, func) for listname in Utils.list_names()]
- else:
+ elif dolist:
listname = args.pop(0).lower().strip()
r = do_list(listname, args, func)
@@ -266,8 +285,11 @@ def main():
pass
namespace = globals().copy()
namespace.update(locals())
- code.InteractiveConsole(namespace).interact(
- _("The variable `m' is the %(listname)s MailList instance"))
+ if dolist:
+ ban = _("The variable `m' is the %(listname)s MailList instance")
+ else:
+ ban = None
+ code.InteractiveConsole(namespace).interact(ban)
diff --git a/configure b/configure
index 81114386..2d1a642b 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
-# From configure.in Revision: 2.39.2.4
+# From configure.in Revision: 2.39.2.5
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13
@@ -2069,7 +2069,6 @@ done
SCRIPTS="build/bin/add_members:bin/add_members \
build/bin/arch:bin/arch \
build/bin/change_pw:bin/change_pw \
-build/bin/reset_pw:bin/reset_pw \
build/bin/check_db:bin/check_db \
build/bin/check_perms:bin/check_perms \
build/bin/cleanarch:bin/cleanarch \
@@ -2093,6 +2092,7 @@ build/bin/newlist:bin/newlist \
build/bin/pygettext.py:bin/pygettext.py \
build/bin/qrunner:bin/qrunner \
build/bin/remove_members:bin/remove_members \
+build/bin/reset_pw.py:bin/reset_pw.py \
build/bin/rmlist:bin/rmlist \
build/bin/show_qfiles:bin/show_qfiles \
build/bin/sync_members:bin/sync_members \
diff --git a/configure.in b/configure.in
index 2e016ea5..628cb13e 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2004 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
@@ -15,7 +15,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
dnl Process this file with autoconf to produce a configure script.
-AC_REVISION($Revision: 7270 $)
+AC_REVISION($Revision: 7272 $)
AC_PREREQ(2.0)
AC_INIT(src/common.h)
@@ -545,7 +545,6 @@ AC_DEFUN(MM_SCRIPTS, [dnl
bin/add_members \
bin/arch \
bin/change_pw \
-bin/reset_pw \
bin/check_db \
bin/check_perms \
bin/cleanarch \
@@ -569,6 +568,7 @@ bin/newlist \
bin/pygettext.py \
bin/qrunner \
bin/remove_members \
+bin/reset_pw.py \
bin/rmlist \
bin/show_qfiles \
bin/sync_members \