summaryrefslogtreecommitdiff
path: root/src/mailman/interfaces
diff options
context:
space:
mode:
authorBarry Warsaw2016-09-08 19:49:00 +1200
committerBarry Warsaw2016-09-08 19:49:00 +1200
commit447b9bd6df0113ca7e2332d6ad20c01691f3ce07 (patch)
tree637eff5c4d0923ae801e225ef0ce09a9821e2642 /src/mailman/interfaces
parent54ae6bb8c78998c533b75d81c3b3e72151813d9e (diff)
downloadmailman-447b9bd6df0113ca7e2332d6ad20c01691f3ce07.tar.gz
mailman-447b9bd6df0113ca7e2332d6ad20c01691f3ce07.tar.zst
mailman-447b9bd6df0113ca7e2332d6ad20c01691f3ce07.zip
Fix many failures.
Also, document more APIs.
Diffstat (limited to 'src/mailman/interfaces')
-rw-r--r--src/mailman/interfaces/mailinglist.py14
-rw-r--r--src/mailman/interfaces/subscriptions.py63
2 files changed, 76 insertions, 1 deletions
diff --git a/src/mailman/interfaces/mailinglist.py b/src/mailman/interfaces/mailinglist.py
index 366016872..2a862cde2 100644
--- a/src/mailman/interfaces/mailinglist.py
+++ b/src/mailman/interfaces/mailinglist.py
@@ -271,6 +271,18 @@ class IMailingList(Interface):
:rtype: Roster
"""
+ def is_subscribed(subscriber, role=MemberRole.member):
+ """Is the given address or user subscribed to the mailing list?
+
+ :param subscriber: The address or user to check.
+ :type subscriber: `IUser` or `IAddress`
+ :param role: The role being checked (e.g. a member, owner, or
+ moderator of a mailing list).
+ :type role: `MemberRole`
+ :return: A flag indicating whether the subscriber is already
+ subscribed to the mailing list or not.
+ """
+
def subscribe(subscriber, role=MemberRole.member):
"""Subscribe the given address or user to the mailing list.
@@ -279,7 +291,7 @@ class IMailingList(Interface):
has one, otherwise no address for the user appears in the rosters.
:type subscriber: `IUser` or `IAddress`
:param role: The role being subscribed to (e.g. a member, owner, or
- moderator of a mailing list.
+ moderator of a mailing list).
:type role: `MemberRole`
:return: The member object representing the subscription.
:rtype: `IMember`
diff --git a/src/mailman/interfaces/subscriptions.py b/src/mailman/interfaces/subscriptions.py
index 62f5be627..9a20b9c0d 100644
--- a/src/mailman/interfaces/subscriptions.py
+++ b/src/mailman/interfaces/subscriptions.py
@@ -224,6 +224,28 @@ class ISubscriptionManager(Interface):
:param subscriber: The user or address to subscribe.
:type email: ``IUser`` or ``IAddress``
+ :param pre_verified: A flag indicating whether the subscriber's email
+ address should be considered pre-verified. Normally a never
+ before seen email address must be verified by mail-back
+ confirmation. Setting this flag to True automatically verifies
+ such addresses without the mail-back. (A confirmation message may
+ still be sent under other conditions.)
+ :type pre_verified: bool
+ :param pre_confirmed: A flag indicating whether, when required by the
+ subscription policy, a subscription request should be considered
+ pre-confirmed. Normally in such cases, a mail-back confirmation
+ message is sent to the subscriber, which must be positively
+ acknowledged by some manner. Setting this flag to True
+ automatically confirms the subscription request. (A confirmation
+ message may still be sent under other conditions.)
+ :type pre_confirmed: bool
+ :param pre_approved: A flag indicating whether, when required by the
+ subscription policy, a subscription request should be considered
+ pre-approved. Normally in such cases, the list administrator is
+ notified that an approval is necessary, which must be positively
+ acknowledged in some manner. Setting this flag to True
+ automatically approves the subscription request.
+ :type pre_approved: bool
:return: A 3-tuple is returned where the first element is the token
hash, the second element is a ``TokenOwner`, and the third element
is the subscribed member. If the subscriber got subscribed
@@ -235,6 +257,47 @@ class ISubscriptionManager(Interface):
appears in the global or list-centric bans.
"""
+ def unregister(subscriber=None, *,
+ pre_confirmed=False, pre_approved=False):
+ """Unsubscribe an address or user according to subscription policies.
+
+ The mailing list's unsubscription policy is used to unsubscribe
+ `subscriber` from the given mailing list. The subscriber can be
+ an ``IUser`` or an ``IAddress``, and must already be subscribed to the
+ mailing list.
+
+ The workflow may pause (i.e. be serialized, saved, and
+ suspended) when some out-of-band confirmation step is required.
+ For example, if the user must confirm, or the moderator must
+ approve the unsubscription. Use the ``confirm(token)`` method to
+ resume the workflow.
+
+ :param subscriber: The user or address to unsubscribe.
+ :type email: ``IUser`` or ``IAddress``
+ :param pre_confirmed: A flag indicating whether, when required by the
+ unsubscription policy, an unsubscription request should be
+ considered pre-confirmed. Normally in such cases, a mail-back
+ confirmation message is sent to the subscriber, which must be
+ positively acknowledged by some manner. Setting this flag to True
+ automatically confirms the unsubscription request. (A confirmation
+ message may still be sent under other conditions.)
+ :type pre_confirmed: bool
+ :param pre_approved: A flag indicating whether, when required by the
+ unsubscription policy, an unsubscription request should be
+ considered pre-approved. Normally in such cases, the list
+ administrator is notified that an approval is necessary, which
+ must be positively acknowledged in some manner. Setting this flag
+ to True automatically approves the unsubscription request.
+ :type pre_approved: bool
+ :return: A 3-tuple is returned where the first element is the token
+ hash, the second element is a ``TokenOwner`, and the third element
+ is the unsubscribing member. If the subscriber got unsubscribed
+ immediately, the token will be None and the member will be
+ an ``IMember``. If the unsubscription got held, the token
+ will be a hash and the member will be None.
+ :rtype: (str-or-None, ``TokenOwner``, ``IMember``-or-None)
+ """
+
def confirm(token):
"""Continue any paused workflow.