[Mailman-Users] Update member's fullname

Mark Sapiro mark at msapiro.net
Thu Feb 14 23:22:34 CET 2008


Fabiano Caixeta Duarte wrote:
>
>I realized that there are scripts for automating creation, deletion end 
>listing of list's members.
>
>How can I update (actually insert) member's fullname in batch mode?
>
>I have a file which contains member's fullname and e-mail address.
>Members were added to mailman with any names associated.


As far as I know, there is no generally available script to do this.

You could create a withlist script (see 'bin/withlist --help')
something along the lines of the following which assumes the your file
contains lines like

Real Name <user at example.com>


-------------------------------------------------------------
from email.Utils import parseaddr
from Mailman.Errors import NotAMemberError

def real_name_from_file(mlist):

    if not mlist.Locked():
        mlist.Lock()

    fp = open('/path/to/name_address/file')

    line = fp.readline()
    while line:
        real_name, address = parseaddr(line)
        if real_name and address:
            try:
                mlist.setMemberName(address.lower(), real_name)
            except NotAMemberError:
                print 'Not a list member: %s' % address.lower()
        line = fp.readline()
    mlist.Save()
    mlist.Unlock()
-------------------------------------------------------------


-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Mailman-Users mailing list