[Mailman-Users] patch written for 2.1 for post-only access.
Jon Carnes
jonc at nc.rr.com
Mon Jan 27 22:18:56 CET 2003
On Mon, 2003-01-27 at 14:43, Jon Carnes wrote:
> Okay. I got it working...
>
> (I have to attach it as a file since my kids just modified my system and
> disabled cut and paste... :-)
>
> The "IsMember function was moved to the module MemberAdaptor and renamed
> "isMember".
>
> The Moderate.py module is very well written and makes it quite easy to
> add checks for passing mail into a moderated list.
>
> I've only done moderate checking on it, but it worked fine for my local
> testing.
>
> Any feedback is welcome - Jon Carnes
> ===
Looks like the attachment didn't go through on the list, so here is the
patch (I fixed my cut/paste problem - so I'm still smarter than the
kids, but just barely!)
======
*** jonc.Moderate.py Mon Jan 27 10:23:03 2003
--- Moderate.py Mon Jan 27 13:19:33 2003
***************
*** 25,28 ****
--- 25,30 ----
from Mailman import Utils
from Mailman import Message
+ from Mailman import MailList
+ from Mailman import MemberAdaptor
from Mailman import Errors
from Mailman.i18n import _
***************
*** 45,48 ****
--- 47,59 ----
^L
+ def CheckPostOnly(sender):
+ try:
+ m = MailList.MailList('post-only', lock=0)
+ return m.isMember(sender)
+ except Errors.MMListError:
+ return 0
+
+
+ ^L
def process(mlist, msg, msgdata):
if msgdata.get('approved'):
***************
*** 89,92 ****
--- 100,105 ----
# From here on out, we're dealing with non-members.
if matches_p(sender, mlist.accept_these_nonmembers):
+ return
+ if CheckPostOnly(sender):
return
if matches_p(sender, mlist.hold_these_nonmembers):
More information about the Mailman-Users
mailing list