[Mailman-Users] command line import dupes option

Mark Sapiro mark at msapiro.net
Fri Oct 19 20:12:18 CEST 2012


Dan Young wrote:
>
>Is there a way to on/off the dupes option via command line?
>Possibly withlist?


See <http://www.msapiro.net/scripts/set_nodups.py>. This withlist
script turns On nodupes for all members of the list. To turn the
setting Off instead, change '1' to '0' in the line

        mlist.setMemberOption(member, mm_cfg.DontReceiveDuplicates, 1)

To do only a few members (e.g. 2), change

    for member in mlist.getMembers():

to

    for member in ['user1 at example.com', 'user2 at example.com']:


>Or better yet, when I import a file of users can I set dupes unchecked?
>I currently do this via command line with a text file not through web admin.

Uncheck the "Filter out duplicate messages to list members (if
possible)" box in the list admin General Options -> new_member_options
settings before running add_members.

You could also do this via withlist. E.g.

bin/withlist -l LIST
Loading list LIST (locked)
The variable `m' is the LIST MailList instance
>>> from Mailman import mm_cfg
>>> m.new_member_options &= ~mm_cfg.DontReceiveDuplicates
>>> m.Save()
>>>
Unlocking (but not saving) list: gpc-test
Finalizing

-- 
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