parent
96cb2bc808
commit
4a312378b7
@ -1,29 +0,0 @@ |
||||
from ..AbstractTransaction import AbstractTransaction |
||||
|
||||
from zope import component |
||||
|
||||
from ceo_common.interfaces import IMailmanService |
||||
|
||||
|
||||
class SubscribeMemberTransaction(AbstractTransaction): |
||||
"""Transaction to subscribe a member to a mailing list.""" |
||||
|
||||
operations = [ |
||||
'subscribe_to_mailing_list', |
||||
] |
||||
|
||||
def __init__(self, address: str, mailing_list: str): |
||||
""" |
||||
:param address: a username or email address |
||||
:param mailing_list: the list to which the user will be subscribed |
||||
""" |
||||
super().__init__() |
||||
self.address = address |
||||
self.mailing_list = mailing_list |
||||
self.mailman_srv = component.getUtility(IMailmanService) |
||||
|
||||
def child_execute_iter(self): |
||||
self.mailman_srv.subscribe(self.address, self.mailing_list) |
||||
yield 'subscribe_to_mailing_list' |
||||
|
||||
self.finish('OK') |
@ -1,29 +0,0 @@ |
||||
from ..AbstractTransaction import AbstractTransaction |
||||
|
||||
from zope import component |
||||
|
||||
from ceo_common.interfaces import IMailmanService |
||||
|
||||
|
||||
class UnsubscribeMemberTransaction(AbstractTransaction): |
||||
"""Transaction to unsubscribe a member from a mailing list.""" |
||||
|
||||
operations = [ |
||||
'unsubscribe_from_mailing_list', |
||||
] |
||||
|
||||
def __init__(self, address: str, mailing_list: str): |
||||
""" |
||||
:param address: a username or email address |
||||
:param mailing_list: the list from which the user will be unsubscribed |
||||
""" |
||||
super().__init__() |
||||
self.address = address |
||||
self.mailing_list = mailing_list |
||||
self.mailman_srv = component.getUtility(IMailmanService) |
||||
|
||||
def child_execute_iter(self): |
||||
self.mailman_srv.unsubscribe(self.address, self.mailing_list) |
||||
yield 'unsubscribe_to_mailing_list' |
||||
|
||||
self.finish('OK') |
@ -1,2 +0,0 @@ |
||||
from .SubscribeMemberTransaction import SubscribeMemberTransaction |
||||
from .UnsubscribeMemberTransaction import UnsubscribeMemberTransaction |
Loading…
Reference in new issue