[Mailman-Users] newlist patch

Derek Simkowiak dereks at kd-dev.com
Sat Jul 1 03:33:03 CEST 2000


     Hello,
	Attached is a patch for the "newlist" utility script.

	It causes all informational messages to go to stderr, and the
generated "aliases" to go to stdout.  Other than that, newlist works
exactly the same (no new command-line options or anything).

	That means you can do this:

bin/newlist >> /etc/aliases
	[...or...]
bin/newlist > /tmp/listname.aliases
	[...or...]
bin/newlist listname owner at domain.com passwd > somefile.txt


	...and the automatically-generated aliases will be in the file
you redirect stdout to.

	Here is a sample run:

[mailman at platinum bin]$ ./newlist > aliases-only.txt 
Enter the name of the list: ft5
Enter the email of the person running the list: dereks at kd-dev.com
Initial ft5 password: 

Entry for aliases file...
Hit enter to continue with ft5 owner notification...

[mailman at platinum bin]$ cat aliases-only.txt 

## ft5 mailing list
## created: 30-Jun-2000 mailman
ft5:                     "|/usr/lib/mailman/mail/wrapper post ft5"
ft5-admin:               "|/usr/lib/mailman/mail/wrapper mailowner ft5"
ft5-request:             "|/usr/lib/mailman/mail/wrapper mailcmd ft5"
ft5-owner:               ft5-admin

[mailman at platinum bin]$ 

	I made this patch because I'm not always in X-windows, meaning I
don't always have a mouse to cut'n'paste the generated aliases into my
/etc/aliases file.  And I'm too lazy to edit out the informational
prompts by hand with vi.

	Also, this patch should make it easier for automated/CGI scripts
that create new lists.  They won't need to worry about specifically
parsing the aliases from the rest of the (informational) output.

	If no-one objects, it would be groovy if this could make it into
2.0beta4 (since it's such a simple script).


Thanks,
Derek Simkowiak
dereks at kd-dev.com
-------------- next part --------------
49,50d48
< Entry for aliases file:
< 
79a78,93
> def raw_input(prompt=''):
> 
>         # A raw_input() replacement that doesn't save the string in the
>         # GNU readline history, and prints the prompt to stderr
>         import sys
>         prompt = str(prompt)
>         if prompt:
>                 sys.stderr.write(prompt)
>         line = sys.stdin.readline()
>         if not line:
>                 raise EOFError
>         if line[-1] == '\n':
>                 line = line[:-1]
>         return line
> 
> 
100a115,117
>         # A simple hack to have getpass() print to stderr, not stdout
>         temp = sys.stdout
>         sys.stdout = sys.stderr
101a119
>         sys.stdout = temp
117a136
>         sys.stderr.write ("\nEntry for aliases file...\n");
131c150
<             print ("Hit enter to continue with %s owner notification..."
---
>             sys.stderr.write ("Hit enter to continue with %s owner notification...\n"


More information about the Mailman-Users mailing list