Re: [Mailman-Users] one line command to change generic_nonmember_action

2010-10-18 Thread Steff Watkins
 

 -Original Message-
 On Behalf Of Syn, Joonho
 Sent: Friday, October 15, 2010 7:53 PM
 To: mailman-users@python.org
 Subject: [Mailman-Users] one line command to change 
 generic_nonmember_action
 
 I'm writing a simplified mailman dashboard page for my 
 company's internal use and one of the functions we want is to 
 be able to toggle the generic_nonmember_action for any given 
 list.  Has anyone out there devised a one line command which 
 will allow this?

Hi,

 I'm not sure if there is a direct command that can do this but I've
been doing something similar lately. I had a setup of 20+ mailing lists
which had to be identical in a specialised configuration. Doing that by
the web interface filled me with dread so I started looking around and
found the mailman utility 'bin/config_list'.

This brilliant (imnsho!) utility allows you to either dump out a list's
configuration in plain text or read in a list's configuration, again in
plain text.

Let's see you have a list called SomeList. You can dump out the entire
configuration (not the members list, just the list's functional
settings) by typing:

   cd ~mailman
   bin/config_list -o - SomeList

This will dump to screen ( -o - ) the configuration of SomeList.

It's just a minor logical step to do

bin/config_list -o /usr/tmp/somelist-conf.txt SomeList

Which dumps the config into a file /usr/tmp/somelist-conf.txt

If you were to look at that file you'd find a section like this:

==
# When a post from a non-member is received, the message's sender is
# matched against the list of explicitly a
# href=?VARHELP=privacy/sender/accept_these_nonmembers accepted,
# held, a href=?VARHELP=privacy/sender/reject_these_nonmembers
# rejected (bounced), and a
# href=?VARHELP=privacy/sender/discard_these_nonmembers discarded
# addresses.  If no match is found, then this action is taken.
#
# legal values are:
#0 = Accept
#1 = Hold
#2 = Reject
#3 = Discard
generic_nonmember_action = 1
=

You could either replace the value at the end of the line, or just swap
in a whole new line.

Then save the text file and read the configuration BACK to the list:

bin/config_list -i /usr/tmp/somelist-conf.txt SomeList

Note the change from '-o' (output) to '-i' (input).

It would be easily possible to pipe these commands together, maybe using
sed as the output=input parser.

So something like,

bin/config_list -o - SomeList | /usr/bin/sed -f swapscript - |
bin/config_list -i - SomeList

Where 'swapscript' is a simple script to detect the
generic_nonmember_action = 1 line and change it as you want.

Of course there's probably a simpler/better way of doing this but it
should work.

Regards,
S Watkins

---
Steff Watkins   Natural History Museum, Cromwell
Road, London, SW7 5BD
Systems programmer  Email: s.watk...@nhm.ac.uk 
Systems TeamPhone: +44 (0)20 7942 6000 opt 2

Many were increasingly of the opinion that they'd all made a big mistake
in coming down from the trees in the first place. And some said that
even the trees had been a bad move, and that no one should ever have
left the oceans. - HHGTTG 
--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] one line command to change generic_nonmember_action

2010-10-18 Thread Mark Sapiro
Syn, Joonho wrote:

I'm writing a simplified mailman dashboard page for my company's internal use 
and one of the functions we want is to be able to toggle the 
generic_nonmember_action for any given list.  Has anyone out there devised a 
one line command which will allow this?


See the FAQ at http://wiki.list.org/x/uIA9.

-- 
Mark Sapiro m...@msapiro.netThe highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] one line command to change generic_nonmember_action

2010-10-18 Thread Adam McGreggor
On Mon, Oct 18, 2010 at 10:46:20AM +0100, Steff Watkins wrote:
   bin/config_list -o /usr/tmp/somelist-conf.txt SomeList
 Which dumps the config into a file /usr/tmp/somelist-conf.txt
 
 Then save the text file and read the configuration BACK to the list:
   bin/config_list -i /usr/tmp/somelist-conf.txt SomeList
 
 Of course there's probably a simpler/better way of doing this but it
 should work.

I've been quite happy using:

http://code.amyl.org.uk/adam/mailman-scripts/debian/editlistconfig

(patches welcome, should anyone think it necessary)

-- 
 Any person who knowingly causes a nuclear weapon test explosion
  or any other nuclear explosion is guilty of an offence
   -- Nuclear Explosions Act, 1998
--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


[Mailman-Users] one line command to change generic_nonmember_action

2010-10-15 Thread Syn, Joonho
I'm writing a simplified mailman dashboard page for my company's internal use 
and one of the functions we want is to be able to toggle the 
generic_nonmember_action for any given list.  Has anyone out there devised a 
one line command which will allow this?
--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org