Discard/Ban all messages pending moderation

Hello,
I was wondering, is there a way i could discard all pending moderation messages and also simultaneously add the sender's address to discard for subsequent mails?
Regards
*Seun Ojedeji, Federal University Oye-Ekiti web: http://www.fuoye.edu.ng Mobile: +2348035233535 **alt email: <http://goog_1872880453>seun.ojedeji@fuoye.edu.ng*

On 05/30/2013 11:37 AM, Seun Ojedeji wrote:
If there aren't too many, it should be easy enough to go to the admindb interface for the list and for each sender in the summary of held messages, check the "Add xxx to one of these sender filters:" box and select the 'Discards' radio button and finally check the 'Discard all messages marked Defer' box and submit changes.
If there are so many that this is unwieldy, you could do this with a withlist script. Something along the lines of the following totally untested script:
from Mailman import mm_cfg def discard(mlist): for id in mlist.GetHeldMessageIds(): sender = mlist.GetRecord(id)[1] if sender not in mlist.discard_these_nonmembers: mlist.discard_these_nonmembers.append(sender) mlist.HandleRequest(id, mm_cfg.DISCARD)
See 'bin/withlist --help' for what to do with this.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

On Thu, May 30, 2013 at 11:49 PM, Mark Sapiro <mark@msapiro.net> wrote:
If there are so many that this is unwieldy,
This is the case...and thanks for providing this script...will test it out. ;-)
Thanks!
--
*Seun Ojedeji, Federal University Oye-Ekiti web: http://www.fuoye.edu.ng Mobile: +2348035233535 **alt email: <http://goog_1872880453>seun.ojedeji@fuoye.edu.ng*

Mark Sapiro wrote:
It occurred to me that there is a problem with the above, namely it doesn't save the list so it will probably discard all the held messages but not update discard_these_nonmembers.
The following is still untested, but should be better
from Mailman import mm_cfg def discard(mlist): if not mlist.Locked(): mlist.Lock() for id in mlist.GetHeldMessageIds(): sender = mlist.GetRecord(id)[1] if sender not in mlist.discard_these_nonmembers: mlist.discard_these_nonmembers.append(sender) mlist.HandleRequest(id, mm_cfg.DISCARD) mlist.Save() mlist.Unlock()
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

On 05/30/2013 11:37 AM, Seun Ojedeji wrote:
If there aren't too many, it should be easy enough to go to the admindb interface for the list and for each sender in the summary of held messages, check the "Add xxx to one of these sender filters:" box and select the 'Discards' radio button and finally check the 'Discard all messages marked Defer' box and submit changes.
If there are so many that this is unwieldy, you could do this with a withlist script. Something along the lines of the following totally untested script:
from Mailman import mm_cfg def discard(mlist): for id in mlist.GetHeldMessageIds(): sender = mlist.GetRecord(id)[1] if sender not in mlist.discard_these_nonmembers: mlist.discard_these_nonmembers.append(sender) mlist.HandleRequest(id, mm_cfg.DISCARD)
See 'bin/withlist --help' for what to do with this.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

On Thu, May 30, 2013 at 11:49 PM, Mark Sapiro <mark@msapiro.net> wrote:
If there are so many that this is unwieldy,
This is the case...and thanks for providing this script...will test it out. ;-)
Thanks!
--
*Seun Ojedeji, Federal University Oye-Ekiti web: http://www.fuoye.edu.ng Mobile: +2348035233535 **alt email: <http://goog_1872880453>seun.ojedeji@fuoye.edu.ng*

Mark Sapiro wrote:
It occurred to me that there is a problem with the above, namely it doesn't save the list so it will probably discard all the held messages but not update discard_these_nonmembers.
The following is still untested, but should be better
from Mailman import mm_cfg def discard(mlist): if not mlist.Locked(): mlist.Lock() for id in mlist.GetHeldMessageIds(): sender = mlist.GetRecord(id)[1] if sender not in mlist.discard_these_nonmembers: mlist.discard_these_nonmembers.append(sender) mlist.HandleRequest(id, mm_cfg.DISCARD) mlist.Save() mlist.Unlock()
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Mark Sapiro
-
Seun Ojedeji