summaryrefslogtreecommitdiff
path: root/src/mailman/interfaces/mailinglist.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/interfaces/mailinglist.py')
-rw-r--r--src/mailman/interfaces/mailinglist.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mailman/interfaces/mailinglist.py b/src/mailman/interfaces/mailinglist.py
index 19db025d1..877016f41 100644
--- a/src/mailman/interfaces/mailinglist.py
+++ b/src/mailman/interfaces/mailinglist.py
@@ -46,6 +46,7 @@ class ReplyToMunging(Enum):
@public
class SubscriptionPolicy(Enum):
+ """All subscription/unsubscription policies for a mailing list."""
# Neither confirmation, nor moderator approval is required.
open = 0
# The user must confirm the subscription.
@@ -256,6 +257,9 @@ class IMailingList(Interface):
subscription_policy = Attribute(
"""The policy for subscribing new members to the list.""")
+ unsubscription_policy = Attribute(
+ """The policy for unsubscribing members from the list.""")
+
subscribers = Attribute(
"""An iterator over all IMembers subscribed to this list, with any
role.
@@ -270,6 +274,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.
@@ -278,7 +294,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`