[Mailman-Developers] Re: [Zest-devel] Re: Pipermail replacement? Zest!
Barry A. Warsaw
barry@zope.com
Wed, 27 Feb 2002 23:12:27 -0500
>>>>> "JRA" == Jay R Ashworth <jra@baylink.com> writes:
JRA> I can't imagine that hooking the Mailman auth code could be
JRA> *that* difficult...
It's not, if you can hack a little Python. Here's a bit of untested
code to get you started. Note: you must have the Mailman package's
parent directory on your PYTHONPATH (aka sys.path).
-Barry
-------------------- snip snip --------------------
from Mailman import Errors
from Mailman.MailList import MailList
def authenticate(listname, address, response):
"""Return true if the response authenticates the address as a
member of the named mailing list (i.e. response == the correct
password).
"""
# Might raise MMListError if listname doesn't exist
mlist = MailList(listname, lock=0)
# Might raise NotAMember if address isn't a member
secret = mlist.authenticateMember(address, response)
if secret:
return 1
return 0