[Mailman-Users] Regexp for blocking addresses

Matthew Saltzman mjs at clemson.edu
Tue Sep 29 20:06:17 CEST 2015


On Tue, 2015-09-29 at 09:55 -0700, Mark Sapiro wrote:
> On 09/29/2015 08:24 AM, Matthew Saltzman wrote:
> > 
> > Got it, thanks. I will switch to that one. Now would like to figure
> > out
> > how to delete all my futile attempts from the ban list. Tried
> > modifying
> > the ban script to remove instead of append, but I'm still doing
> > something wrong.
> 
> 
> 
> If the various list's ban_list attributes were empty to start with,
> use
> the following withlist script based on
> <https://www.msapiro.net/scripts/add_banned.py>
> 
> ----------------------Cut-----------------------------
> """Set the ban_list for all lists to a single address or regexp.
> 
> Save as bin/set_banned.py
> 
> Run via
> 
>    bin/withlist -a -r set_banned -- <address_to_ban>
> 
> where <address_to_ban> is the actual email address or regexp
> to be set as ban_list for all lists.
> """
> 
> def set_banned(mlist, address):
>     if not mlist.Locked():
>         mlist.Lock()
>     mlist.ban_list = [address]
>     mlist.Save()
>     mlist.Unlock()
> ----------------------Cut-----------------------------
> 
> If you want to remove individual regexps/addresses from all list's
> ban_list, changing 'ban_list.append(address)' to
> 'ban_list.remove(address)' in whatever script you were using should
> work, but the value of 'address' has to be exactly what is in
> ban_list
> that you want to remove.
> 

Got it.  Thanks for all your help.

-- 
Matthew Saltzman
Clemson University Math Sciences
mjs AT clemson DOT edu


More information about the Mailman-Users mailing list