[Mailman-Developers] Mailman and Extend.py

Mark Sapiro mark at msapiro.net
Fri Apr 10 05:17:36 CEST 2009


C Nulk wrote:
>
>I have recently implemented the LDAPMembership adapter.  It provides
>some good functionality in creating the list membership.  However, the
>concept is there to provide access to one or more lists of email
>addresses (list membership is essentially a list of email addresses).  I
>would like to use the LDAP functionality in other areas which require or
>use a list of email addresses (e.g. accept_these_nonmembers,
>hold_these_nonmembers, etc).
>
>I have looked at the F.A.Q. on custom handlers and read the MailList.py
>file (under __init__) to see the 'extend.py' file being loaded.
>
>Can someone better explain how loading the 'extend.py' file incorporates
>the files code and how the 'def extend' function is called?  If I can
>understand how it works, perhaps, a solution to adding multiple LDAP
>search queries can be added to the extend.py file and used in other
>places in Mailman.


Chris,

The extend.py mechanism as you use it basically just replaces the
default mamber adaptor OLDStyleMembertships.py with LDAPMemberships.py
for any list that has the extend.py file in it's lists/LISTNAME/
directory. In addition, it defines a few attributes which may or may
not be list-specific which allow LDAPMemberships.py to get to the
appropriate LDAP database.

If you've read the __init__ method in MailList.py, you've seen
everything there is to see about extend.py. It gets called there and
there only when the list is instantiated and sets the lists
._memberadaptor attribute to LDAPMemberships.

>From then on, whenever a member adaptor method is called for that list,
the method that is called is the one defined in LDAPMemberships.py.

So, for example, if your Mailman version is 2.1.10 or later so that it
supports the @LISTNAME entry in *_these_nonmembers, and you put say
@list2 in accept_these_nonmembers of list1, list1's processing of a
non-member post will call list2's isMember() method to see if the
poster is a member of list2, and if list2 already uses
LDAPMemberships, that's it - it's isMember() method will use its LDAP
database.

See the matches_p function in Mailman/Handlers/Moderate.py for more
detail.

I hope this helps. If you still have questions, keep asking.

-- 
Mark Sapiro <mark at msapiro.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