FAQ
Hi all,

Is it possible with Mailman 2.1.4-1 to change user settings from a
command line tool? For example set nomail to 1 for a user on a mailing
list? I looked in the bin directory and none of the utilities appear to
be designed to do this, does anyone have any suggestions?

Tia

Regards
Geoff

Search Discussions

  • Jim Tittsler at May 7, 2004 at 2:56 am

    On May 6, 2004, at 17:25, Geoff Powell wrote:

    Is it possible with Mailman 2.1.4-1 to change user settings from a
    command line tool? For example set nomail to 1 for a user on a mailing
    list? I looked in the bin directory and none of the utilities appear to
    be designed to do this, does anyone have any suggestions?
    You can do this sort of thing with 'withlist'.

    $ bin/withlist -l -i mylist
    m.setDeliveryStatus('user at domain.com', MailList.MemberAdaptor.BYADMIN)
    m.Save()
    {ctrl-D}

    If this is the sort of thing you are going to do often, you should
    create a little Python script to remember the messy bits and save some
    typing. You could create a file called nomail.py containing:

    from Mailman.Errors import NotAMemberError
    from Mailman.MemberAdaptor import BYADMIN

    def nomail(m, addr):
    try:
    m.setDeliveryStatus(addr, BYADMIN)
    m.Save()
    except NotAMemberError:
    print 'No address matched:', addr

    Then to disable someone, do (either explicitly or with a script or
    alias):

    $ bin/withlist -l -r nomail mylist user at domain.com

    --
    Jim Tittsler http://www.OnJapan.net/ GPG: 0x01159DB6
    Python Starship http://Starship.Python.net/
    Ringo MUG Tokyo http://www.ringo.net/rss.html
  • Geoff Powell at May 7, 2004 at 9:21 am
    Jim,

    Thankyou, the code you have put forward makes sense and is what I
    wanted. After making a few small mods, it's now doing what I want. I
    have also found some other good examples of 'withlist' usage which
    helped.

    One further question though :), the permissions on most of Mailman's
    files on the system in /var/mailman are owned by root with gid of
    mailman, mask 0744. My question is, if I do not want to run my scripts
    as root, is it fine for me to modify the permissions on these files, or
    is this likely to cause unexpected results for the web front end/system
    python scripts? Even if I add users to the mailman group, they are
    unlikely to have full access to the mailman databases etc.

    Thanks & Regards

    Geoff
    -----Original Message-----
    From: Jim Tittsler [mailto:jwt at onjapan.net]
    Sent: Friday, 7 May 2004 12:57 PM
    To: Geoff Powell
    Cc: mailman-users at python.org
    Subject: Re: [Mailman-Users] Change user settings through command line

    On May 6, 2004, at 17:25, Geoff Powell wrote:

    Is it possible with Mailman 2.1.4-1 to change user settings from a
    command line tool? For example set nomail to 1 for a user
    on a mailing
    list? I looked in the bin directory and none of the
    utilities appear
    to be designed to do this, does anyone have any suggestions?
    You can do this sort of thing with 'withlist'.

    $ bin/withlist -l -i mylist
    m.setDeliveryStatus('user at domain.com', MailList.MemberAdaptor.BYADMIN)
    m.Save()
    {ctrl-D}

    If this is the sort of thing you are going to do often, you should
    create a little Python script to remember the messy bits and
    save some
    typing. You could create a file called nomail.py containing:

    from Mailman.Errors import NotAMemberError
    from Mailman.MemberAdaptor import BYADMIN

    def nomail(m, addr):
    try:
    m.setDeliveryStatus(addr, BYADMIN)
    m.Save()
    except NotAMemberError:
    print 'No address matched:', addr

    Then to disable someone, do (either explicitly or with a script or
    alias):

    $ bin/withlist -l -r nomail mylist user at domain.com

    --
    Jim Tittsler http://www.OnJapan.net/ GPG: 0x01159DB6
    Python Starship http://Starship.Python.net/
    Ringo MUG Tokyo http://www.ringo.net/rss.html
  • Jim Tittsler at May 7, 2004 at 9:50 am

    On May 7, 2004, at 18:21, Geoff Powell wrote:

    One further question though :), the permissions on most of Mailman's
    files on the system in /var/mailman are owned by root with gid of
    mailman, mask 0744. My question is, if I do not want to run my scripts
    as root, is it fine for me to modify the permissions on these files, or
    is this likely to cause unexpected results for the web front end/system
    python scripts? Even if I add users to the mailman group, they are
    unlikely to have full access to the mailman databases etc.
    I would expect your mailman list databases already to be group
    writeable by the mailman group. (Check the files in
    /usr/local/mailman/lists/** or maybe /var/mailman/lists/** in your
    case.)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmailman-users @
categoriespython
postedMay 6, '04 at 8:25a
activeMay 7, '04 at 9:50a
posts4
users2
websitelist.org

2 users in discussion

Geoff Powell: 2 posts Jim Tittsler: 2 posts

People

Translate

site design / logo © 2022 Grokbase