summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mailman/__init__.py26
-rw-r--r--src/mailman/interfaces/action.py26
-rw-r--r--src/mailman/interfaces/address.py29
-rw-r--r--src/mailman/interfaces/api.py7
-rw-r--r--src/mailman/interfaces/archiver.py14
-rw-r--r--src/mailman/interfaces/autorespond.py19
-rw-r--r--src/mailman/interfaces/bans.py11
-rw-r--r--src/mailman/interfaces/bounce.py17
-rw-r--r--src/mailman/interfaces/chain.py33
-rw-r--r--src/mailman/interfaces/command.py17
-rw-r--r--src/mailman/interfaces/configuration.py15
-rw-r--r--src/mailman/interfaces/database.py13
-rw-r--r--src/mailman/interfaces/digests.py10
-rw-r--r--src/mailman/interfaces/domain.py22
-rw-r--r--src/mailman/interfaces/handler.py8
-rw-r--r--src/mailman/interfaces/languages.py11
-rw-r--r--src/mailman/interfaces/listmanager.py22
-rw-r--r--src/mailman/interfaces/mailinglist.py25
-rw-r--r--src/mailman/interfaces/member.py35
-rw-r--r--src/mailman/interfaces/messages.py13
-rw-r--r--src/mailman/interfaces/mime.py13
-rw-r--r--src/mailman/interfaces/mlistrequest.py8
-rw-r--r--src/mailman/interfaces/mta.py16
-rw-r--r--src/mailman/interfaces/nntp.py8
-rw-r--r--src/mailman/interfaces/pending.py17
-rw-r--r--src/mailman/interfaces/permissions.py33
-rw-r--r--src/mailman/interfaces/preferences.py8
-rw-r--r--src/mailman/interfaces/registrar.py11
-rw-r--r--src/mailman/interfaces/requests.py11
-rw-r--r--src/mailman/interfaces/roster.py8
-rw-r--r--src/mailman/interfaces/rules.py8
-rw-r--r--src/mailman/interfaces/runner.py11
-rw-r--r--src/mailman/interfaces/styles.py15
-rw-r--r--src/mailman/interfaces/subscriptions.py23
-rw-r--r--src/mailman/interfaces/switchboard.py8
-rw-r--r--src/mailman/interfaces/system.py8
-rw-r--r--src/mailman/interfaces/templates.py8
-rw-r--r--src/mailman/interfaces/user.py18
-rw-r--r--src/mailman/interfaces/usermanager.py8
-rw-r--r--src/mailman/interfaces/workflow.py11
-rw-r--r--src/mailman/testing/i18n.py3
41 files changed, 199 insertions, 428 deletions
diff --git a/src/mailman/__init__.py b/src/mailman/__init__.py
index 445be2b0d..716e7aecf 100644
--- a/src/mailman/__init__.py
+++ b/src/mailman/__init__.py
@@ -29,6 +29,19 @@ except ImportError: # pragma: no cover
__path__ = pkgutil.extend_path(__path__, __name__)
+# I hate myself: http://bugs.python.org/issue26632
+def public(thing):
+ if isinstance(thing, str):
+ mdict = sys._getframe(1).f_globals
+ name = thing
+ else:
+ mdict = sys.modules[thing.__module__].__dict__
+ name = thing.__name__
+ dunder_all = mdict.setdefault('__all__', [])
+ dunder_all.append(name)
+ return thing
+
+
# We have to initialize the i18n subsystem before anything else happens,
# however, we'll initialize it differently for tests. We have to do it this
# early so that module contents is set up before anything that needs it is
@@ -41,16 +54,3 @@ if 'build_sphinx' not in sys.argv: # pragma: no cover
else:
from mailman.core.i18n import initialize
initialize()
-
-
-# I hate myself: http://bugs.python.org/issue26632
-def public(thing):
- if isinstance(thing, str):
- mdict = sys._getframe(1).f_globals
- name = thing
- else:
- mdict = sys.modules[thing.__module__].__dict__
- name = thing.__name__
- dunder_all = mdict.setdefault('__all__', [])
- dunder_all.append(name)
- return thing
diff --git a/src/mailman/interfaces/action.py b/src/mailman/interfaces/action.py
index e8cb6de83..dcff41cbd 100644
--- a/src/mailman/interfaces/action.py
+++ b/src/mailman/interfaces/action.py
@@ -17,29 +17,25 @@
"""Message actions."""
-__all__ = [
- 'Action',
- 'FilterAction',
- ]
-
-
from enum import Enum
+from mailman import public
-
+@public
class Action(Enum):
- hold = 0
- reject = 1
+ hold = 0
+ reject = 1
discard = 2
- accept = 3
- defer = 4
+ accept = 3
+ defer = 4
+@public
class FilterAction(Enum):
- hold = 0
- reject = 1
+ hold = 0
+ reject = 1
discard = 2
- accept = 3
- defer = 4
+ accept = 3
+ defer = 4
forward = 5
preserve = 6
diff --git a/src/mailman/interfaces/address.py b/src/mailman/interfaces/address.py
index a21190a94..19a9d930c 100644
--- a/src/mailman/interfaces/address.py
+++ b/src/mailman/interfaces/address.py
@@ -17,24 +17,12 @@
"""Interface for email address related information."""
-__all__ = [
- 'AddressAlreadyLinkedError',
- 'AddressError',
- 'AddressNotLinkedError',
- 'AddressVerificationEvent',
- 'EmailError',
- 'ExistingAddressError',
- 'IAddress',
- 'IEmailValidator',
- 'InvalidEmailAddressError',
- ]
-
-
+from mailman import public
from mailman.interfaces.errors import MailmanError
from zope.interface import Interface, Attribute
-
+@public
class EmailError(MailmanError):
"""A generic text email address-related error occurred."""
@@ -46,6 +34,7 @@ class EmailError(MailmanError):
return self.email
+@public
class AddressError(MailmanError):
"""A generic IAddress-related error occurred."""
@@ -57,23 +46,27 @@ class AddressError(MailmanError):
return str(self.address)
+@public
class ExistingAddressError(AddressError):
"""The given email address already exists."""
+@public
class AddressAlreadyLinkedError(AddressError):
"""The address is already linked to a user."""
+@public
class AddressNotLinkedError(AddressError):
"""The address is not linked to the user."""
+@public
class InvalidEmailAddressError(EmailError):
"""Email address is invalid."""
-
+@public
class AddressVerificationEvent:
"""Triggered when an address gets verified or unverified."""
@@ -81,14 +74,14 @@ class AddressVerificationEvent:
self.address = address
def __str__(self):
- return '<{0} {1} {2}>'.format(
+ return '<{} {} {}>'.format(
self.__class__.__name__,
self.address.email,
('unverified' if self.address.verified_on is None
else self.address.verified_on))
-
+@public
class IAddress(Interface):
"""Email address related information."""
@@ -128,7 +121,7 @@ class IAddress(Interface):
"""This address's preferences.""")
-
+@public
class IEmailValidator(Interface):
"""An email validator."""
diff --git a/src/mailman/interfaces/api.py b/src/mailman/interfaces/api.py
index 1e1d15d44..8096f40eb 100644
--- a/src/mailman/interfaces/api.py
+++ b/src/mailman/interfaces/api.py
@@ -17,14 +17,11 @@
"""REST web service API context."""
-__all__ = [
- 'IAPI',
- ]
-
-
+from mailman import public
from zope.interface import Attribute, Interface
+@public
class IAPI(Interface):
"""The REST web service context."""
diff --git a/src/mailman/interfaces/archiver.py b/src/mailman/interfaces/archiver.py
index 62edbb05b..9a210d74e 100644
--- a/src/mailman/interfaces/archiver.py
+++ b/src/mailman/interfaces/archiver.py
@@ -17,32 +17,26 @@
"""Interface for archiving schemes."""
-__all__ = [
- 'ArchivePolicy',
- 'ClobberDate',
- 'IArchiver',
- ]
-
-
from enum import Enum
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class ArchivePolicy(Enum):
never = 0
private = 1
public = 2
-
+@public
class ClobberDate(Enum):
never = 1
maybe = 2
always = 3
-
+@public
class IArchiver(Interface):
"""An interface to the archiver."""
diff --git a/src/mailman/interfaces/autorespond.py b/src/mailman/interfaces/autorespond.py
index f2c231f02..7f6d44711 100644
--- a/src/mailman/interfaces/autorespond.py
+++ b/src/mailman/interfaces/autorespond.py
@@ -17,24 +17,17 @@
"""Autoresponder."""
-__all__ = [
- 'ALWAYS_REPLY',
- 'IAutoResponseRecord',
- 'IAutoResponseSet',
- 'Response',
- 'ResponseAction',
- ]
-
-
from datetime import timedelta
from enum import Enum
+from mailman import public
from zope.interface import Interface, Attribute
ALWAYS_REPLY = timedelta()
+__all__ = ['ALWAYS_REPLY']
-
+@public
class Response(Enum):
# Your message was held for approval.
hold = 1
@@ -46,7 +39,7 @@ class Response(Enum):
postings = 4
-
+@public
class ResponseAction(Enum):
# No automatic response.
none = 0
@@ -56,7 +49,7 @@ class ResponseAction(Enum):
respond_and_continue = 2
-
+@public
class IAutoResponseRecord(Interface):
"""An auto-response record.
@@ -75,7 +68,7 @@ class IAutoResponseRecord(Interface):
response_type = Attribute("""The type of response sent.""")
-
+@public
class IAutoResponseSet(Interface):
"""Matching and setting auto-responses.
diff --git a/src/mailman/interfaces/bans.py b/src/mailman/interfaces/bans.py
index eabfa7247..2e320965a 100644
--- a/src/mailman/interfaces/bans.py
+++ b/src/mailman/interfaces/bans.py
@@ -17,16 +17,11 @@
"""Manager of email address bans."""
-__all__ = [
- 'IBan',
- 'IBanManager',
- ]
-
-
+from mailman import public
from zope.interface import Attribute, Interface
-
+@public
class IBan(Interface):
"""A specific ban.
@@ -43,7 +38,7 @@ class IBan(Interface):
""")
-
+@public
class IBanManager(Interface):
"""The global manager of email address bans.
diff --git a/src/mailman/interfaces/bounce.py b/src/mailman/interfaces/bounce.py
index 35b62ae24..0e39ca3b9 100644
--- a/src/mailman/interfaces/bounce.py
+++ b/src/mailman/interfaces/bounce.py
@@ -17,19 +17,12 @@
"""Interface to bounce detection components."""
-__all__ = [
- 'BounceContext',
- 'IBounceEvent',
- 'IBounceProcessor',
- 'UnrecognizedBounceDisposition',
- ]
-
-
from enum import Enum
+from mailman import public
from zope.interface import Attribute, Interface
-
+@public
class BounceContext(Enum):
"""The context in which the bounce was detected."""
@@ -42,7 +35,7 @@ class BounceContext(Enum):
probe = 2
-
+@public
class UnrecognizedBounceDisposition(Enum):
# Just throw the message away.
discard = 0
@@ -53,7 +46,7 @@ class UnrecognizedBounceDisposition(Enum):
site_owner = 2
-
+@public
class IBounceEvent(Interface):
"""Registration record for a single bounce event."""
@@ -76,7 +69,7 @@ class IBounceEvent(Interface):
"""Has this bounce event been processed?""")
-
+@public
class IBounceProcessor(Interface):
"""Manager/processor of bounce events."""
diff --git a/src/mailman/interfaces/chain.py b/src/mailman/interfaces/chain.py
index ac5868465..3fccb4090 100644
--- a/src/mailman/interfaces/chain.py
+++ b/src/mailman/interfaces/chain.py
@@ -17,26 +17,12 @@
"""Interfaces describing the basics of chains and links."""
-__all__ = [
- 'AcceptEvent',
- 'AcceptOwnerEvent',
- 'ChainEvent',
- 'DiscardEvent',
- 'HoldEvent',
- 'IChain',
- 'IChainIterator',
- 'IChainLink',
- 'IMutableChain',
- 'LinkAction',
- 'RejectEvent',
- ]
-
-
from enum import Enum
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class ChainEvent:
"""Base class for chain notification events."""
@@ -47,27 +33,32 @@ class ChainEvent:
self.chain = chain
+@public
class AcceptEvent(ChainEvent):
"""A notification event signaling that a message is being accepted."""
+@public
class AcceptOwnerEvent(ChainEvent):
"""An event signaling that a message is accepted to the -owner address."""
+@public
class DiscardEvent(ChainEvent):
"""A notification event signaling that a message is being discarded."""
+@public
class HoldEvent(ChainEvent):
"""A notification event signaling that a message is being held."""
+@public
class RejectEvent(ChainEvent):
"""A notification event signaling that a message is being rejected."""
-
+@public
class LinkAction(Enum):
# Jump to another chain.
jump = 0
@@ -82,7 +73,7 @@ class LinkAction(Enum):
run = 4
-
+@public
class IChainLink(Interface):
"""A link in the chain."""
@@ -102,7 +93,7 @@ class IChainLink(Interface):
""")
-
+@public
class IChain(Interface):
"""A chain of rules."""
@@ -119,7 +110,7 @@ class IChain(Interface):
"""
-
+@public
class IChainIterator(Interface):
"""An iterator over chain rules."""
@@ -130,7 +121,7 @@ class IChainIterator(Interface):
"""
-
+@public
class IMutableChain(IChain):
"""Like `IChain` but can be mutated."""
diff --git a/src/mailman/interfaces/command.py b/src/mailman/interfaces/command.py
index 9ccb9a0f4..76bf8aa1c 100644
--- a/src/mailman/interfaces/command.py
+++ b/src/mailman/interfaces/command.py
@@ -17,33 +17,26 @@
"""Interfaces defining email commands."""
-__all__ = [
- 'ContinueProcessing',
- 'ICLISubCommand',
- 'IEmailCommand',
- 'IEmailResults',
- ]
-
-
from enum import Enum
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class ContinueProcessing(Enum):
"""Should `IEmailCommand.process()` continue or not."""
no = 0
yes = 1
-
+@public
class IEmailResults(Interface):
"""The email command results object."""
output = Attribute('An output file object for printing results to.')
-
+@public
class IEmailCommand(Interface):
"""An email command."""
@@ -66,7 +59,7 @@ class IEmailCommand(Interface):
"""
-
+@public
class ICLISubCommand(Interface):
"""A command line interface subcommand."""
diff --git a/src/mailman/interfaces/configuration.py b/src/mailman/interfaces/configuration.py
index f68ba4785..2e38e614c 100644
--- a/src/mailman/interfaces/configuration.py
+++ b/src/mailman/interfaces/configuration.py
@@ -17,18 +17,12 @@
"""Configuration system interface."""
-__all__ = [
- 'ConfigurationUpdatedEvent',
- 'IConfiguration',
- 'MissingConfigurationFileError',
- ]
-
-
+from mailman import public
from mailman.interfaces.errors import MailmanError
from zope.interface import Interface
-
+@public
class MissingConfigurationFileError(MailmanError):
"""A named configuration file was not found."""
@@ -36,13 +30,14 @@ class MissingConfigurationFileError(MailmanError):
self.path = path
-
+@public
class IConfiguration(Interface):
"""Marker interface; used for adaptation in the REST API."""
-
+@public
class ConfigurationUpdatedEvent:
"""The system-wide global configuration was updated."""
+
def __init__(self, config):
self.config = config
diff --git a/src/mailman/interfaces/database.py b/src/mailman/interfaces/database.py
index 8751e4dc0..1f658c556 100644
--- a/src/mailman/interfaces/database.py
+++ b/src/mailman/interfaces/database.py
@@ -17,22 +17,17 @@
"""Interfaces for database interaction."""
-__all__ = [
- 'DatabaseError',
- 'IDatabase',
- 'IDatabaseFactory',
- ]
-
-
+from mailman import public
from mailman.interfaces.errors import MailmanError
from zope.interface import Attribute, Interface
+@public
class DatabaseError(MailmanError):
"""A problem with the database occurred."""
-
+@public
class IDatabase(Interface):
"""Database layer interface."""
@@ -58,7 +53,7 @@ class IDatabase(Interface):
"""The underlying database object on which you can do queries.""")
-
+@public
class IDatabaseFactory(Interface):
"Interface for creating new databases."""
diff --git a/src/mailman/interfaces/digests.py b/src/mailman/interfaces/digests.py
index 8b0b2c7fa..0bff36ec4 100644
--- a/src/mailman/interfaces/digests.py
+++ b/src/mailman/interfaces/digests.py
@@ -17,16 +17,12 @@
"""One last digest."""
-__all__ = [
- 'IOneLastDigest'
- ]
-
-
from enum import Enum
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class DigestFrequency(Enum):
yearly = 0
monthly = 1
@@ -35,7 +31,7 @@ class DigestFrequency(Enum):
daily = 4
-
+@public
class IOneLastDigest(Interface):
"""Users who should receive one last digest."""
diff --git a/src/mailman/interfaces/domain.py b/src/mailman/interfaces/domain.py
index e978479df..eef391071 100644
--- a/src/mailman/interfaces/domain.py
+++ b/src/mailman/interfaces/domain.py
@@ -17,22 +17,12 @@
"""Interface representing domains."""
-__all__ = [
- 'BadDomainSpecificationError',
- 'DomainCreatedEvent',
- 'DomainCreatingEvent',
- 'DomainDeletedEvent',
- 'DomainDeletingEvent',
- 'IDomain',
- 'IDomainManager',
- ]
-
-
+from mailman import public
from mailman.interfaces.errors import MailmanError
from zope.interface import Interface, Attribute
-
+@public
class BadDomainSpecificationError(MailmanError):
"""The specification of a virtual domain is invalid or duplicated."""
@@ -41,6 +31,7 @@ class BadDomainSpecificationError(MailmanError):
self.domain = domain
+@public
class DomainCreatingEvent:
"""A domain is about to be created."""
@@ -48,6 +39,7 @@ class DomainCreatingEvent:
self.mail_host = mail_host
+@public
class DomainCreatedEvent:
"""A domain was created."""
@@ -55,6 +47,7 @@ class DomainCreatedEvent:
self.domain = domain
+@public
class DomainDeletingEvent:
"""A domain is about to be deleted."""
@@ -62,6 +55,7 @@ class DomainDeletingEvent:
self.domain = domain
+@public
class DomainDeletedEvent:
"""A domain was deleted."""
@@ -69,7 +63,7 @@ class DomainDeletedEvent:
self.mail_host = mail_host
-
+@public
class IDomain(Interface):
"""Interface representing domains."""
@@ -107,7 +101,7 @@ class IDomain(Interface):
"""
-
+@public
class IDomainManager(Interface):
"""The manager of domains."""
diff --git a/src/mailman/interfaces/handler.py b/src/mailman/interfaces/handler.py
index 20e29d111..f6b2aea66 100644
--- a/src/mailman/interfaces/handler.py
+++ b/src/mailman/interfaces/handler.py
@@ -17,15 +17,11 @@
"""Interface describing a pipeline handler."""
-__all__ = [
- 'IHandler',
- ]
-
-
+from mailman import public
from zope.interface import Attribute, Interface
-
+@public
class IHandler(Interface):
"""A basic pipeline handler."""
diff --git a/src/mailman/interfaces/languages.py b/src/mailman/interfaces/languages.py
index ca212c2c2..129b5e1df 100644
--- a/src/mailman/interfaces/languages.py
+++ b/src/mailman/interfaces/languages.py
@@ -17,16 +17,11 @@
"""Interfaces for managing languages."""
-__all__ = [
- 'ILanguage',
- 'ILanguageManager',
- ]
-
-
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class ILanguage(Interface):
"""The representation of a language."""
@@ -37,7 +32,7 @@ class ILanguage(Interface):
description = Attribute("The language's description.")
-
+@public
class ILanguageManager(Interface):
"""A language manager.
diff --git a/src/mailman/interfaces/listmanager.py b/src/mailman/interfaces/listmanager.py
index 5f8d3931f..0887248b2 100644
--- a/src/mailman/interfaces/listmanager.py
+++ b/src/mailman/interfaces/listmanager.py
@@ -17,22 +17,12 @@
"""Interface for list storage, deleting, and finding."""
-__all__ = [
- 'IListManager',
- 'ListAlreadyExistsError',
- 'ListCreatedEvent',
- 'ListCreatingEvent',
- 'ListDeletedEvent',
- 'ListDeletingEvent',
- 'NoSuchListError',
- ]
-
-
+from mailman import public
from mailman.interfaces.errors import MailmanError
from zope.interface import Interface, Attribute
-
+@public
class ListAlreadyExistsError(MailmanError):
"""Attempted to create a mailing list that already exists.
@@ -41,6 +31,7 @@ class ListAlreadyExistsError(MailmanError):
"""
+@public
class NoSuchListError(MailmanError):
"""Attempt to access a mailing list that does not exist."""
@@ -51,6 +42,7 @@ class NoSuchListError(MailmanError):
return 'No such mailing list: {0.fqdn_listname}'.format(self)
+@public
class ListCreatingEvent:
"""A mailing list is about to be created."""
@@ -58,6 +50,7 @@ class ListCreatingEvent:
self.fqdn_listname = fqdn_listname
+@public
class ListCreatedEvent:
"""A mailing list was created."""
@@ -65,6 +58,7 @@ class ListCreatedEvent:
self.mailing_list = mlist
+@public
class ListDeletingEvent:
"""A mailing list is about to be deleted."""
@@ -72,6 +66,7 @@ class ListDeletingEvent:
self.mailing_list = mailing_list
+@public
class ListDeletedEvent:
"""A mailing list was deleted."""
@@ -79,8 +74,7 @@ class ListDeletedEvent:
self.fqdn_listname = fqdn_listname
-
-
+@public
class IListManager(Interface):
"""The interface of the global list manager.
diff --git a/src/mailman/interfaces/mailinglist.py b/src/mailman/interfaces/mailinglist.py
index 4b98ff6a7..4ccf97a6d 100644
--- a/src/mailman/interfaces/mailinglist.py
+++ b/src/mailman/interfaces/mailinglist.py
@@ -17,25 +17,13 @@
"""Interface for a mailing list."""
-__all__ = [
- 'IAcceptableAlias',
- 'IAcceptableAliasSet',
- 'IHeaderMatch',
- 'IHeaderMatchList',
- 'IListArchiver',
- 'IListArchiverSet',
- 'IMailingList',
- 'Personalization',
- 'ReplyToMunging',
- 'SubscriptionPolicy',
- ]
-
-
from enum import Enum
+from mailman import public
from mailman.interfaces.member import MemberRole
from zope.interface import Interface, Attribute
+@public
class Personalization(Enum):
none = 0
# Everyone gets a unique copy of the message, and there are a few more
@@ -46,6 +34,7 @@ class Personalization(Enum):
full = 2
+@public
class ReplyToMunging(Enum):
# The Reply-To header is passed through untouched
no_munging = 0
@@ -55,6 +44,7 @@ class ReplyToMunging(Enum):
explicit_header = 2
+@public
class SubscriptionPolicy(Enum):
# Neither confirmation, nor moderator approval is required.
open = 0
@@ -67,6 +57,7 @@ class SubscriptionPolicy(Enum):
confirm_then_moderate = 3
+@public
class IMailingList(Interface):
"""A mailing list."""
@@ -778,6 +769,7 @@ class IMailingList(Interface):
)
+@public
class IAcceptableAlias(Interface):
"""An acceptable alias for implicit destinations."""
@@ -786,6 +778,7 @@ class IAcceptableAlias(Interface):
address = Attribute('The address or pattern to match against recipients.')
+@public
class IAcceptableAliasSet(Interface):
"""The set of acceptable aliases for a mailing list."""
@@ -816,6 +809,7 @@ class IAcceptableAliasSet(Interface):
"""An iterator over all the acceptable aliases.""")
+@public
class IListArchiver(Interface):
"""An archiver for a mailing list.
@@ -833,6 +827,7 @@ class IListArchiver(Interface):
'The associated system-wide IArchiver instance.')
+@public
class IListArchiverSet(Interface):
"""The set of archivers (enabled or disabled) for a mailing list."""
@@ -849,6 +844,7 @@ class IListArchiverSet(Interface):
"""
+@public
class IHeaderMatch(Interface):
"""A mailing list-specific message header matching rule."""
@@ -875,6 +871,7 @@ class IHeaderMatch(Interface):
""")
+@public
class IHeaderMatchList(Interface):
"""The list of header matching rules for a mailing list."""
diff --git a/src/mailman/interfaces/member.py b/src/mailman/interfaces/member.py
index 91c2aab0a..dd8d3f383 100644
--- a/src/mailman/interfaces/member.py
+++ b/src/mailman/interfaces/member.py
@@ -17,28 +17,13 @@
"""Interface describing the basics of a member."""
-__all__ = [
- 'AlreadySubscribedError',
- 'DeliveryMode',
- 'DeliveryStatus',
- 'IMember',
- 'MemberRole',
- 'MembershipChangeEvent',
- 'MembershipError',
- 'MembershipIsBannedError',
- 'MissingPreferredAddressError',
- 'NotAMemberError',
- 'SubscriptionEvent',
- 'UnsubscriptionEvent',
- ]
-
-
from enum import Enum
+from mailman import public
from mailman.interfaces.errors import MailmanError
from zope.interface import Interface, Attribute
-
+@public
class DeliveryMode(Enum):
# Regular (i.e. non-digest) delivery
regular = 1
@@ -50,7 +35,7 @@ class DeliveryMode(Enum):
summary_digests = 4
-
+@public
class DeliveryStatus(Enum):
# Delivery is enabled
enabled = 1
@@ -64,7 +49,7 @@ class DeliveryStatus(Enum):
unknown = 5
-
+@public
class MemberRole(Enum):
member = 1
owner = 2
@@ -72,7 +57,7 @@ class MemberRole(Enum):
nonmember = 4
-
+@public
class MembershipChangeEvent:
"""Base class for subscription/unsubscription events."""
@@ -81,6 +66,7 @@ class MembershipChangeEvent:
self.member = member
+@public
class SubscriptionEvent(MembershipChangeEvent):
"""Event which gets triggered when a user joins a mailing list."""
@@ -88,6 +74,7 @@ class SubscriptionEvent(MembershipChangeEvent):
return '{0} joined {1}'.format(self.member.address, self.mlist.list_id)
+@public
class UnsubscriptionEvent(MembershipChangeEvent):
"""Event which gets triggered when a user leaves a mailing list.
@@ -100,11 +87,12 @@ class UnsubscriptionEvent(MembershipChangeEvent):
return '{0} left {1}'.format(self.member.address, self.mlist.list_id)
-
+@public
class MembershipError(MailmanError):
"""Base exception for all membership errors."""
+@public
class AlreadySubscribedError(MembershipError):
"""The member is already subscribed to the mailing list with this role."""
@@ -119,6 +107,7 @@ class AlreadySubscribedError(MembershipError):
self.email, self.role, self.fqdn_listname)
+@public
class MembershipIsBannedError(MembershipError):
"""The address is not allowed to subscribe to the mailing list."""
@@ -132,6 +121,7 @@ class MembershipIsBannedError(MembershipError):
self._address, self._mlist)
+@public
class MissingPreferredAddressError(MembershipError):
"""A user without a preferred address attempted to subscribe."""
@@ -143,6 +133,7 @@ class MissingPreferredAddressError(MembershipError):
return 'User must have a preferred address: {0}'.format(self._user)
+@public
class NotAMemberError(MembershipError):
"""The address is not a member of the mailing list."""
@@ -156,7 +147,7 @@ class NotAMemberError(MembershipError):
self._address, self._mlist)
-
+@public
class IMember(Interface):
"""A member of a mailing list."""
diff --git a/src/mailman/interfaces/messages.py b/src/mailman/interfaces/messages.py
index ed8dad4c7..cd05722c9 100644
--- a/src/mailman/interfaces/messages.py
+++ b/src/mailman/interfaces/messages.py
@@ -17,16 +17,11 @@
"""The message storage service."""
-__all__ = [
- 'IMessage',
- 'IMessageStore',
- ]
-
-
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class IMessageStore(Interface):
"""The interface of the global message storage service.
@@ -57,7 +52,7 @@ class IMessageStore(Interface):
the globally unique URI would be:
http://archive.example.com/RXTJ357KFOTJP3NFJA6KMO65X7VQOHJI
-"""
+ """
def add(message):
"""Add the message to the store.
@@ -100,7 +95,7 @@ class IMessageStore(Interface):
"""An iterator over all messages in this message store.""")
-
+@public
class IMessage(Interface):
"""The representation of an email message."""
diff --git a/src/mailman/interfaces/mime.py b/src/mailman/interfaces/mime.py
index afa49b243..e30354cd9 100644
--- a/src/mailman/interfaces/mime.py
+++ b/src/mailman/interfaces/mime.py
@@ -17,18 +17,12 @@
"""MIME content filtering."""
-__all__ = [
- 'FilterAction',
- 'FilterType',
- 'IContentFilter',
- ]
-
-
from enum import Enum
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class FilterAction(Enum):
# Discard a message that matches the content type filter.
discard = 0
@@ -40,6 +34,7 @@ class FilterAction(Enum):
preserve = 3
+@public
class FilterType(Enum):
# Filter MIME type.
filter_mime = 0
@@ -51,7 +46,7 @@ class FilterType(Enum):
pass_extension = 3
-
+@public
class IContentFilter(Interface):
"""A single content filter settings for a mailing list."""
diff --git a/src/mailman/interfaces/mlistrequest.py b/src/mailman/interfaces/mlistrequest.py
index 4ff4b9385..731caf147 100644
--- a/src/mailman/interfaces/mlistrequest.py
+++ b/src/mailman/interfaces/mlistrequest.py
@@ -17,15 +17,11 @@
"""Interface for a web request accessing a mailing list."""
-__all__ = [
- 'IMailingListRequest',
- ]
-
-
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class IMailingListRequest(Interface):
"""The web request accessing a mailing list."""
diff --git a/src/mailman/interfaces/mta.py b/src/mailman/interfaces/mta.py
index 8c168c3a1..47436ead5 100644
--- a/src/mailman/interfaces/mta.py
+++ b/src/mailman/interfaces/mta.py
@@ -17,18 +17,12 @@
"""Interface for mail transport agent integration."""
-__all__ = [
- 'IMailTransportAgentAliases',
- 'IMailTransportAgentDelivery',
- 'IMailTransportAgentLifecycle',
- ]
-
-
+from mailman import public
from mailman.interfaces.errors import MailmanError
from zope.interface import Interface
-
+@public
class SomeRecipientsFailed(MailmanError):
"""Delivery to some or all recipients failed"""
def __init__(self, temporary_failures, permanent_failures):
@@ -37,7 +31,7 @@ class SomeRecipientsFailed(MailmanError):
self.permanent_failures = permanent_failures
-
+@public
class IMailTransportAgentAliases(Interface):
"""Interface to the MTA utility for generating all the aliases."""
@@ -70,7 +64,7 @@ class IMailTransportAgentAliases(Interface):
"""
-
+@public
class IMailTransportAgentLifecycle(Interface):
"""Interface to the MTA for creating and deleting a mailing list."""
@@ -89,7 +83,7 @@ class IMailTransportAgentLifecycle(Interface):
"""
-
+@public
class IMailTransportAgentDelivery(Interface):
"""Interface to the MTA delivery strategies."""
diff --git a/src/mailman/interfaces/nntp.py b/src/mailman/interfaces/nntp.py
index e9a584366..72a74fe90 100644
--- a/src/mailman/interfaces/nntp.py
+++ b/src/mailman/interfaces/nntp.py
@@ -17,15 +17,11 @@
"""NNTP and newsgroup interfaces."""
-__all__ = [
- 'NewsgroupModeration',
- ]
-
-
from enum import Enum
+from mailman import public
-
+@public
class NewsgroupModeration(Enum):
# The newsgroup is not moderated.
none = 0
diff --git a/src/mailman/interfaces/pending.py b/src/mailman/interfaces/pending.py
index 40db0e585..b7621cbe2 100644
--- a/src/mailman/interfaces/pending.py
+++ b/src/mailman/interfaces/pending.py
@@ -22,18 +22,11 @@ maps these events to a unique hash that can be used as a token for end user
confirmation.
"""
-__all__ = [
- 'IPendable',
- 'IPended',
- 'IPendedKeyValue',
- 'IPendings',
- ]
-
-
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class IPendable(Interface):
"""A pendable object."""
@@ -58,7 +51,7 @@ class IPendable(Interface):
"""
-
+@public
class IPended(Interface):
"""A pended event, tied to a token."""
@@ -67,7 +60,7 @@ class IPended(Interface):
expiration_date = Attribute("""The expiration date of the pended event.""")
-
+@public
class IPendedKeyValue(Interface):
"""A pended key/value pair."""
@@ -76,7 +69,7 @@ class IPendedKeyValue(Interface):
value = Attribute("""The pended value.""")
-
+@public
class IPendings(Interface):
"""Interface to pending database."""
diff --git a/src/mailman/interfaces/permissions.py b/src/mailman/interfaces/permissions.py
deleted file mode 100644
index 3fe92a62b..000000000
--- a/src/mailman/interfaces/permissions.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2007-2016 by the Free Software Foundation, Inc.
-#
-# This file is part of GNU Mailman.
-#
-# GNU Mailman is free software: you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation, either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
-
-"""Interfaces for various permissions."""
-
-__all__ = [
- 'IPostingPermission',
- ]
-
-
-from zope.interface import Interface, Attribute
-
-
-
-class IPostingPermission(Interface):
- """Posting related permissions."""
-
- okay_to_post = Attribute(
- """Boolean specifying whether it is okay to post to the list.""")
diff --git a/src/mailman/interfaces/preferences.py b/src/mailman/interfaces/preferences.py
index 7bdd5dbef..b3690ac35 100644
--- a/src/mailman/interfaces/preferences.py
+++ b/src/mailman/interfaces/preferences.py
@@ -17,15 +17,11 @@
"""Interface for preferences."""
-__all__ = [
- 'IPreferences',
- ]
-
-
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class IPreferences(Interface):
"""Delivery related information."""
diff --git a/src/mailman/interfaces/registrar.py b/src/mailman/interfaces/registrar.py
index ad023ced9..e2cec5fbb 100644
--- a/src/mailman/interfaces/registrar.py
+++ b/src/mailman/interfaces/registrar.py
@@ -22,16 +22,11 @@ etc. than the IUserManager. The latter does no validation, syntax checking,
or confirmation, while this interface does.
"""
-__all__ = [
- 'ConfirmationNeededEvent',
- 'IRegistrar',
- ]
-
-
+from mailman import public
from zope.interface import Interface
-
+@public
class ConfirmationNeededEvent:
"""Triggered when an address needs confirmation.
@@ -45,7 +40,7 @@ class ConfirmationNeededEvent:
self.email = email
-
+@public
class IRegistrar(Interface):
"""Interface for subscribing addresses and users.
diff --git a/src/mailman/interfaces/requests.py b/src/mailman/interfaces/requests.py
index 28c4b5e84..be164183e 100644
--- a/src/mailman/interfaces/requests.py
+++ b/src/mailman/interfaces/requests.py
@@ -21,24 +21,19 @@ The request database handles events that must be approved by the list
moderators, such as subscription requests and held messages.
"""
-__all__ = [
- 'IListRequests',
- 'RequestType',
- ]
-
-
from enum import Enum
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class RequestType(Enum):
held_message = 1
subscription = 2
unsubscription = 3
-
+@public
class IListRequests(Interface):
"""Held requests for a specific mailing list."""
diff --git a/src/mailman/interfaces/roster.py b/src/mailman/interfaces/roster.py
index f8efa4259..5ad36847b 100644
--- a/src/mailman/interfaces/roster.py
+++ b/src/mailman/interfaces/roster.py
@@ -17,15 +17,11 @@
"""Interface for a roster of members."""
-__all__ = [
- 'IRoster',
- ]
-
-
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class IRoster(Interface):
"""A roster is a collection of `IMembers`."""
diff --git a/src/mailman/interfaces/rules.py b/src/mailman/interfaces/rules.py
index ca7c313c4..7093da5a7 100644
--- a/src/mailman/interfaces/rules.py
+++ b/src/mailman/interfaces/rules.py
@@ -17,15 +17,11 @@
"""Interface describing the basics of rules."""
-__all__ = [
- 'IRule',
- ]
-
-
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class IRule(Interface):
"""A basic rule."""
diff --git a/src/mailman/interfaces/runner.py b/src/mailman/interfaces/runner.py
index 520229ac1..aed8edddf 100644
--- a/src/mailman/interfaces/runner.py
+++ b/src/mailman/interfaces/runner.py
@@ -17,16 +17,11 @@
"""Interface for runners."""
-__all__ = [
- 'IRunner',
- 'RunnerCrashEvent',
- ]
-
-
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class RunnerCrashEvent:
"""Triggered when a runner encounters an exception in _dispose()."""
@@ -38,7 +33,7 @@ class RunnerCrashEvent:
self.error = error
-
+@public
class IRunner(Interface):
"""The runner."""
diff --git a/src/mailman/interfaces/styles.py b/src/mailman/interfaces/styles.py
index b5be5d977..5629af5d4 100644
--- a/src/mailman/interfaces/styles.py
+++ b/src/mailman/interfaces/styles.py
@@ -17,23 +17,17 @@
"""Interfaces for list styles."""
-__all__ = [
- 'DuplicateStyleError',
- 'IStyle',
- 'IStyleManager',
- ]
-
-
+from mailman import public
from mailman.interfaces.errors import MailmanError
from zope.interface import Interface, Attribute
-
+@public
class DuplicateStyleError(MailmanError):
"""A style with the same name is already registered."""
-
+@public
class IStyle(Interface):
"""Application of a style to an existing mailing list."""
@@ -47,7 +41,8 @@ class IStyle(Interface):
:param mailing_list: the mailing list to apply the style to.
"""
-
+
+@public
class IStyleManager(Interface):
"""A manager of styles."""
diff --git a/src/mailman/interfaces/subscriptions.py b/src/mailman/interfaces/subscriptions.py
index 5ce046a30..157bf1b62 100644
--- a/src/mailman/interfaces/subscriptions.py
+++ b/src/mailman/interfaces/subscriptions.py
@@ -17,24 +17,15 @@
"""Membership interface for REST."""
-__all__ = [
- 'ISubscriptionService',
- 'MissingUserError',
- 'RequestRecord',
- 'SubscriptionPendingError',
- 'TokenOwner',
- 'TooManyMembersError',
- ]
-
-
from collections import namedtuple
from enum import Enum
+from mailman import public
from mailman.interfaces.errors import MailmanError
from mailman.interfaces.member import DeliveryMode, MembershipError
from zope.interface import Interface
-
+@public
class MissingUserError(MailmanError):
"""A an invalid user id was given."""
@@ -46,6 +37,7 @@ class MissingUserError(MailmanError):
return self.user_id
+@public
class SubscriptionPendingError(MailmanError):
def __init__(self, mlist, email):
super().__init__()
@@ -53,6 +45,7 @@ class SubscriptionPendingError(MailmanError):
self.email = email
+@public
class TooManyMembersError(MembershipError):
def __init__(self, subscriber, list_id, role):
super().__init__()
@@ -61,10 +54,12 @@ class TooManyMembersError(MembershipError):
self.role = role
-
_RequestRecord = namedtuple(
'RequestRecord',
'email display_name delivery_mode, language')
+
+
+@public
def RequestRecord(email, display_name='',
delivery_mode=DeliveryMode.regular,
language=None):
@@ -74,7 +69,7 @@ def RequestRecord(email, display_name='',
return _RequestRecord(email, display_name, delivery_mode, language)
-
+@public
class TokenOwner(Enum):
"""Who 'owns' the token returned from the registrar?"""
no_one = 0
@@ -82,7 +77,7 @@ class TokenOwner(Enum):
moderator = 2
-
+@public
class ISubscriptionService(Interface):
"""General Subscription services."""
diff --git a/src/mailman/interfaces/switchboard.py b/src/mailman/interfaces/switchboard.py
index 1449926e0..30dd62843 100644
--- a/src/mailman/interfaces/switchboard.py
+++ b/src/mailman/interfaces/switchboard.py
@@ -17,15 +17,11 @@
"""Interface for switchboards."""
-__all__ = [
- 'ISwitchboard',
- ]
-
-
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class ISwitchboard(Interface):
"""The switchboard."""
diff --git a/src/mailman/interfaces/system.py b/src/mailman/interfaces/system.py
index 721d4838e..95e92b20c 100644
--- a/src/mailman/interfaces/system.py
+++ b/src/mailman/interfaces/system.py
@@ -17,15 +17,11 @@
"""System information."""
-__all__ = [
- 'ISystem',
- ]
-
-
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class ISystem(Interface):
"""Information about the Mailman system."""
diff --git a/src/mailman/interfaces/templates.py b/src/mailman/interfaces/templates.py
index 699dedcef..40bc86d2a 100644
--- a/src/mailman/interfaces/templates.py
+++ b/src/mailman/interfaces/templates.py
@@ -17,15 +17,11 @@
"""Template downloader with cache."""
-__all__ = [
- 'ITemplateLoader',
- ]
-
-
+from mailman import public
from zope.interface import Interface
-
+@public
class ITemplateLoader(Interface):
"""The template downloader utility."""
diff --git a/src/mailman/interfaces/user.py b/src/mailman/interfaces/user.py
index a39624d9b..f80b51583 100644
--- a/src/mailman/interfaces/user.py
+++ b/src/mailman/interfaces/user.py
@@ -17,23 +17,17 @@
"""Interface describing the basics of a user."""
-__all__ = [
- 'IUser',
- 'PasswordChangeEvent',
- 'UnverifiedAddressError',
- ]
-
-
+from mailman import public
from mailman.interfaces.address import AddressError
from zope.interface import Interface, Attribute
-
+@public
class UnverifiedAddressError(AddressError):
"""Unverified address cannot be used as a user's preferred address."""
-
+@public
class PasswordChangeEvent:
"""Event which gets triggered when a user changes their password."""
@@ -41,11 +35,11 @@ class PasswordChangeEvent:
self.user = user
def __str__(self):
- return '<{0} {1}>'.format(self.__class__.__name__,
- self.user.display_name)
+ return '<{} {}>'.format(
+ self.__class__.__name__, self.user.display_name)
-
+@public
class IUser(Interface):
"""A basic user."""
diff --git a/src/mailman/interfaces/usermanager.py b/src/mailman/interfaces/usermanager.py
index 6e8a8d471..3cd18bd20 100644
--- a/src/mailman/interfaces/usermanager.py
+++ b/src/mailman/interfaces/usermanager.py
@@ -17,15 +17,11 @@
"""Interface describing the user management service."""
-__all__ = [
- 'IUserManager',
- ]
-
-
+from mailman import public
from zope.interface import Interface, Attribute
-
+@public
class IUserManager(Interface):
"""The global user management service."""
diff --git a/src/mailman/interfaces/workflow.py b/src/mailman/interfaces/workflow.py
index bfd3ab89d..bf2138959 100644
--- a/src/mailman/interfaces/workflow.py
+++ b/src/mailman/interfaces/workflow.py
@@ -17,16 +17,11 @@
"""Interfaces describing the state of a workflow."""
-__all__ = [
- 'IWorkflowState',
- 'IWorkflowStateManager',
- ]
-
-
+from mailman import public
from zope.interface import Attribute, Interface
-
+@public
class IWorkflowState(Interface):
"""The state of a workflow."""
@@ -39,7 +34,7 @@ class IWorkflowState(Interface):
data = Attribute('Additional data (may be JSON-encoded).')
-
+@public
class IWorkflowStateManager(Interface):
"""The workflow states manager."""
diff --git a/src/mailman/testing/i18n.py b/src/mailman/testing/i18n.py
index 9846a92ac..92189302c 100644
--- a/src/mailman/testing/i18n.py
+++ b/src/mailman/testing/i18n.py
@@ -26,7 +26,6 @@ __all__ = [
from contextlib import closing
from flufl.i18n import registry
from gettext import GNUTranslations, NullTranslations
-from mailman.core.i18n import initialize as core_initialize
from pkg_resources import resource_stream
@@ -48,6 +47,8 @@ class TestingStrategy:
def initialize():
"""Install a global underscore function for testing purposes."""
+ # Avoid circular imports.
+ from mailman.core.i18n import initialize as core_initialize
strategy = TestingStrategy('mailman-testing')
application = registry.register(strategy)
core_initialize(application)