
Hi,
If i have to hook into user's subscriptions (new/edit/remove) and then perform specific non mailman related activities, how do I go about it?
Bibek Shrestha bibekshrestha at gmail dot com Blog: http://bibekshrestha.com.np Twitter: http://twitter.com/bibstha

On May 27, 2010, at 12:17 PM, Bibek Shrestha wrote:
If i have to hook into user's subscriptions (new/edit/remove) and then perform specific non mailman related activities, how do I go about it?
In Mailman 3 we use the zope.event system to broadcast certain changes. I'm not positive that subscription events are all generated, but it would be very easy to add them.
So with that, you could write an extension or plugin that just listens for the interesting events, and then do whatever you want with them.
-Barry

Bibek Shrestha wrote:
If i have to hook into user's subscriptions (new/edit/remove) and then perform specific non mailman related activities, how do I go about it?
Barry has answered for MM3. For MM 2.1, there are no hooks for this built in. You would have to add your own.
The most elegant way to do this would be create your own MemberAdaptor as a subclass of whatever MemberAdaptor you are currently using. Mailman by default uses OldStyleMemberships.OldStyleMemberships which itself is a subclass of the generic MemberAdaptor.MemberAdaptor class.
You could create MyMemberAdaptor.py in the Mailman/ directory to contain
from Mailman import OldStyleMemberships
class MyMemberAdaptor(OldStyleMemberships.OldStyleMemberships):
and then override those methods you want to hook into.
Then, there are a couple of ways to enable this MemberAdaptor. To enable it for one or a few lists, place a file named extend.py in the lists/LISTNAME/ directory for the list(s). This file contains
from Mailman.MyMemberAdaptor import MyMemberAdaptor def extend(mlist): mlist._memberadaptor = MyMemberAdaptor(mlist)
To enable it for all lists, you could patch MailList.py, adding
from Mailman.MyMemberAdaptor import MyMemberAdaptor
and changing
# Default membership adaptor class
self._memberadaptor = OldStyleMemberships(self)
to
# Default membership adaptor class
self._memberadaptor = MyMemberAdaptor(self)
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

On May 27, 2010, at 12:17 PM, Bibek Shrestha wrote:
If i have to hook into user's subscriptions (new/edit/remove) and then perform specific non mailman related activities, how do I go about it?
In Mailman 3 we use the zope.event system to broadcast certain changes. I'm not positive that subscription events are all generated, but it would be very easy to add them.
So with that, you could write an extension or plugin that just listens for the interesting events, and then do whatever you want with them.
-Barry

Bibek Shrestha wrote:
If i have to hook into user's subscriptions (new/edit/remove) and then perform specific non mailman related activities, how do I go about it?
Barry has answered for MM3. For MM 2.1, there are no hooks for this built in. You would have to add your own.
The most elegant way to do this would be create your own MemberAdaptor as a subclass of whatever MemberAdaptor you are currently using. Mailman by default uses OldStyleMemberships.OldStyleMemberships which itself is a subclass of the generic MemberAdaptor.MemberAdaptor class.
You could create MyMemberAdaptor.py in the Mailman/ directory to contain
from Mailman import OldStyleMemberships
class MyMemberAdaptor(OldStyleMemberships.OldStyleMemberships):
and then override those methods you want to hook into.
Then, there are a couple of ways to enable this MemberAdaptor. To enable it for one or a few lists, place a file named extend.py in the lists/LISTNAME/ directory for the list(s). This file contains
from Mailman.MyMemberAdaptor import MyMemberAdaptor def extend(mlist): mlist._memberadaptor = MyMemberAdaptor(mlist)
To enable it for all lists, you could patch MailList.py, adding
from Mailman.MyMemberAdaptor import MyMemberAdaptor
and changing
# Default membership adaptor class
self._memberadaptor = OldStyleMemberships(self)
to
# Default membership adaptor class
self._memberadaptor = MyMemberAdaptor(self)
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (3)
-
Barry Warsaw
-
Bibek Shrestha
-
Mark Sapiro