[Mailman-Users] Subject: newlist output [was: New user comments]
smead at amplepower.com
Fri Jun 16 22:54:56 CEST 2000
You can do things like sys.stdout.write(line), where no '\n' is added to
line as it would be with print.
On Fri, 16 Jun 2000, Gary Algier wrote:
> Alright I'm tired of all the pros and cons of writing a file. Here
> are patches to bin/newlist:
> --- bin/newlist.old Fri Jun 16 14:10:21 2000
> +++ bin/newlist Fri Jun 16 14:15:09 2000
> @@ -46,7 +46,6 @@
> ALIASTEMPLATE = '''
> -Entry for aliases file:
> ## %(listname)s mailing list
> ## created: %(date)s %(user)s
> @@ -128,7 +127,7 @@
> if len(argv) < 5:
> - print ("Hit enter to continue with %s owner notification..."
> + sys.stderr.write ("Hit enter to continue with %s owner notification..."
> % listname),
> # send the notice to the list owner
> These patches will make the "Hit enter" `text go to stderr and they will
> omit the "Entry for...". If you want to "see" the output and cut and
> paste with a mouse, use:
> newlist listname user at domain.com somepasswd
> If you don't have or want a mouse, use:
> newlist listname user at domain.com somepasswd >>/etc/aliases
> Also, if one wants to use this in a CGI it will write the useful stuff
> to stdout so it can be picked up by the CGI script and be used directly.
> Placing the data in a hardcoded file, _of_any_name_, is wrong. What if
> two instances of "newlist" are run at the same time? (I am assuming,
> of course, that the rest of the code in newlist is properly protected).
> Two little side questions (being a non-pythoner):
> Why does everyting write to stdout? Why is there no
> sys.stderr.print method?
> Gary Algier, WB2FWZ gary.algier at ulticom.com +1 856 787 2758
> Ulticom Inc., 1020 Briggs Rd, Mt. Laurel, NJ 08054 Fax:+1 856 866 2033
> This space intentionally left blank by the censors.
> Mailman-Users maillist - Mailman-Users at python.org
More information about the Mailman-Users