[Mailman-Developers] Re: Info on newlist bug

Tanner Lovelace lovelace@wayfarer.org
Wed, 15 Nov 2000 00:00:15 -0500


Phil Barnett wrote:
> 
> Here is the traceback for the failure. Now that I think about it, it's
> probably that the bin/newlist executable is looking at the 0
> parameter instead of the 1 parameter.
> 

At the beginning of main there is this line of code
that parses the arguments.

opts, args = getopt.getopt(sys.argv[1:], 'ho:',
                           ['help', 'output='])

getopt takes the passed in arguments (sys.argv[1:])
and removes the ones it takes care of leaving the
rest in the "args" variable.  Unfortunately, later
on when reading the command line arguments they
are read from the original argv instead of the
modified args.  Attached is a patch that fixes 
this problem.

Tanner Lovelace
--- 
Tanner Lovelace
lovelace@wayfarer.org
http://wtl.wayfarer.org/
Cthulu for President.  Why settle for the lesser evil?

--- newlist.orig	Tue Nov 14 23:48:13 2000
+++ newlist	Tue Nov 14 23:55:47 2000
@@ -125,7 +125,7 @@
             usage(0)
 
     if len(args) > 0:
-	listname = argv[0]
+	listname = args[0]
     else:
 	listname = raw_input("Enter the name of the list: ")
     listname = string.lower(listname)
@@ -137,13 +137,13 @@
         usage(1, 'List already exists: ' + listname)
 
     if len(args) > 1:
-	owner_mail = argv[1]
+	owner_mail = args[1]
     else:
 	owner_mail = raw_input(
 	    "Enter the email of the person running the list: ")
 
     if len(args) > 2:
-	list_pw = argv[2]
+	list_pw = args[2]
     else:
         list_pw = getpass.getpass("Initial %s password: " % listname)
     # List passwords cannot be empty