[Mailman-Developers] Determining if a user or list has moderation

Jeff Kunzelman (DHL) Jeff.Kunzelman at dhl.com
Mon Apr 16 18:58:34 CEST 2007

Just wanted to post my quick and dirty solution to reporting on
moderated lists. I wrote a perl script to execute the withlist command
with output from the list_lists command:

### Begin Perl ###

# open file
open(FILE, "listsTest.txt") or die("Unable to open file");

# read file into an array
@lists = <FILE>;

# close file

foreach $line (@lists)

       my @listname = split(/\s-\s/, $line);

       @listname[0] =~ s/\s//g;

       $moderators = `./withlist -q -r checkModerated.list_moderated

       if (length($moderators) > 0)
         print $listname[0],  " Moderated Users \n";
         print $listname[0], " No Moderated Users \n"; 


### end ###

My python script to find the moderated users:

### begin python ####

from Mailman import mm_cfg

def list_moderated(m):
    for member in m.getMembers():
        if m.getMemberOption(member, mm_cfg.Moderate):
            print member

 ### end ###

Thanks for answers to my questions!!!

-----Original Message-----
From: Mark Sapiro [mailto:msapiro at value.net] 
Sent: Thursday, April 12, 2007 9:44 PM
To: Jeff Kunzelman (DHL); mailman-developers at python.org
Subject: Re: [Mailman-Developers] Determining if a user or list has

Jeff Kunzelman (DHL) wrote:
>However when I run the command:
>withlist -q -r checkModerated.py jww_test
>I get the following error:
>Traceback (most recent call last):
>  File "/home/mailman/bin/withlist", line 297, in ?
>    main()
>  File "/home/mailman/bin/withlist", line 269, in main
>    func = getattr(mod, callable)
>AttributeError: 'module' object has no attribute 'py'

The help for withlist says

    --run [module.]callable
    -r [module.]callable

I realize this is cryptic, but in your case (module file name =
checkModerated.py; function name/callable = list_moderated) it means the
withlist command needs to be

withlist -q -r checkModerated.list_moderated jww_test

Note that the 'module name' does not include the .py suffix of the file
name. Alternatively, if you named the file list_moderated.py, you could
run it with

withlist -q -r list_moderated jww_test

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-Developers mailing list