[Mailman-Users] nodupes flag

Mark Sapiro msapiro at value.net
Fri Dec 2 06:58:59 CET 2005


Young, Darren wrote:
>
>> M.S. Wrote:
>> You can set the old_domain subscription mail delivery to 'disabled'
>> (nomail in the admin membership page). Then members in both domains
>> will be able to post from either, but will only receive at new_domain
>>
>
>A scriptlet that withlist could call to set these? I've set and/or
>enforced list level options (privacy, bounce processing, archival) with
>those many times over, is it possible to act on an individual list
>membership in the same manner? I'm really not much of a Python coder
>(Perl is fine) so if I can avoid writing Python directly I do. In fact,
>I'm so bad at Python that I wrote .pm's as wrappers around the supplied
>command line utilities to do all my admin tasks.


The method mlist.getDeliveryStatus(member) gets the delivery status of
member. The method mlist.setDeliveryStatus(member, status) sets the
status of member to status.

Valid values for status are

# Delivery statuses
ENABLED  = 0                           # enabled
UNKNOWN  = 1                           # legacy disabled
BYUSER   = 2                           # disabled by user choice
BYADMIN  = 3                           # disabled by admin choice
BYBOUNCE = 4                           # disabled by bounces

You can set these as a numeric value or you can import them from
Mailman.MemberAdaptor.

For example:

--------Begin set_byadmin.py------------------
from Mailman.MemberAdaptor import BYADMIN

def set_byadmin(mlist):
    mlist.Lock()
    for email in mlist.getMembers():
        user, domain = email.split('@')
        if domain == 'old_domain':
            mlist.setDeliveryStatus(email, BYADMIN)
    mlist.Save()
    mlist.Unlock()
--------End set_byadmin.py-------------------

Save the above as bin/set_byadmin.py, then

bin/withlist -a -r set_byadmin

Disclaimer: Barely tested! No Warranty!
As someone once said, "If it breaks, you get to keep all the pieces."



>I want to mention this as well to you personally. I haven't had the need
>to post to this list in many months, however, almost every time I have a
>question (95+%) you have had an answer. Kudo's and thanks.


Thank you. OCD is a terrible thing to waste. :-)

-- 
Mark Sapiro <msapiro at value.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