diff options
| author | Barry Warsaw | 2009-01-16 21:04:21 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2009-01-16 21:04:21 -0500 |
| commit | ae3d0cc316b826b8325507d960ccf84da601c3b0 (patch) | |
| tree | 3485e2ca463c2131a0ffb1693bc60d569cc9d8b7 /mailman/interfaces | |
| parent | a3f7d07c62b2f7d6ac9d0b700883826c2838db60 (diff) | |
| download | mailman-ae3d0cc316b826b8325507d960ccf84da601c3b0.tar.gz mailman-ae3d0cc316b826b8325507d960ccf84da601c3b0.tar.zst mailman-ae3d0cc316b826b8325507d960ccf84da601c3b0.zip | |
Several important cleanups.
* Turn on absolute_import and unicode_literals everywhere, and deal with the
aftermath.
* Use 'except X as Y' everywhere.
* Make the module prologues much more consistent.
* Use '{}'.format() consistently, except for logger interface.
* Because of the problems with calling ** args with unicode keywords, hide
calls to Template.substitute() behind an API.
Diffstat (limited to 'mailman/interfaces')
28 files changed, 198 insertions, 5 deletions
diff --git a/mailman/interfaces/address.py b/mailman/interfaces/address.py index 802952774..968ded3ee 100644 --- a/mailman/interfaces/address.py +++ b/mailman/interfaces/address.py @@ -17,8 +17,19 @@ """Interface for email address related information.""" -from zope.interface import Interface, Attribute +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'AddressAlreadyLinkedError', + 'AddressError', + 'AddressNotLinkedError', + 'ExistingAddressError', + 'IAddress', + ] + +from zope.interface import Interface, Attribute from mailman.interfaces.errors import MailmanError diff --git a/mailman/interfaces/archiver.py b/mailman/interfaces/archiver.py index c69b13427..35fee2c9e 100644 --- a/mailman/interfaces/archiver.py +++ b/mailman/interfaces/archiver.py @@ -17,12 +17,15 @@ """Interface for archiving schemes.""" +from __future__ import absolute_import, unicode_literals + __metaclass__ = type __all__ = [ 'IArchiver', 'IPipermailMailingList', ] + from zope.interface import Interface, Attribute from mailman.interfaces.mailinglist import IMailingList diff --git a/mailman/interfaces/chain.py b/mailman/interfaces/chain.py index 2a18d3dea..2685b7980 100644 --- a/mailman/interfaces/chain.py +++ b/mailman/interfaces/chain.py @@ -17,6 +17,18 @@ """Interfaces describing the basics of chains and links.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IChain', + 'IChainIterator', + 'IChainLink', + 'IMutableChain', + 'LinkAction', + ] + + from munepy import Enum from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/command.py b/mailman/interfaces/command.py index 202d2a148..a9ad292f4 100644 --- a/mailman/interfaces/command.py +++ b/mailman/interfaces/command.py @@ -17,6 +17,16 @@ """Interfaces defining email commands.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'ContinueProcessing', + 'IEmailCommand', + 'IEmailResults', + ] + + from munepy import Enum from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/database.py b/mailman/interfaces/database.py index 27ab4bf83..4a9d6cde5 100644 --- a/mailman/interfaces/database.py +++ b/mailman/interfaces/database.py @@ -23,6 +23,8 @@ setup.py file as an entry point in the 'mailman.database' group with the name Mailman's back end. """ +from __future__ import absolute_import, unicode_literals + __metaclass__ = type __all__ = [ 'DatabaseError', @@ -49,9 +51,9 @@ class SchemaVersionMismatchError(DatabaseError): self._got = got def __str__(self): - return ( - 'Incompatible database schema version (got: %d, expected: %d)' - % (self._got, DATABASE_SCHEMA_VERSION)) + return ('Incompatible database schema version ' + '(got: {0}, expected: {1})'.format( + self._got, DATABASE_SCHEMA_VERSION)) diff --git a/mailman/interfaces/domain.py b/mailman/interfaces/domain.py index 9ce402a70..8c2a27e79 100644 --- a/mailman/interfaces/domain.py +++ b/mailman/interfaces/domain.py @@ -17,6 +17,14 @@ """Interface representing domains.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IDomain', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/errors.py b/mailman/interfaces/errors.py index b174aa3cf..608193f7a 100644 --- a/mailman/interfaces/errors.py +++ b/mailman/interfaces/errors.py @@ -22,6 +22,13 @@ components. More specific exceptions will be located in the relevant interfaces. """ +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'MailmanError', + ] + class MailmanError(Exception): diff --git a/mailman/interfaces/handler.py b/mailman/interfaces/handler.py index 9d03b7263..41d791d5d 100644 --- a/mailman/interfaces/handler.py +++ b/mailman/interfaces/handler.py @@ -17,6 +17,14 @@ """Interface describing a pipeline handler.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IHandler', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/languages.py b/mailman/interfaces/languages.py index d1cdf9f43..272cf4372 100644 --- a/mailman/interfaces/languages.py +++ b/mailman/interfaces/languages.py @@ -17,6 +17,15 @@ """Interfaces for managing languages.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'ILanguage', + 'ILanguageManager', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/listmanager.py b/mailman/interfaces/listmanager.py index 6a774a04e..e7cdd9da7 100644 --- a/mailman/interfaces/listmanager.py +++ b/mailman/interfaces/listmanager.py @@ -17,6 +17,8 @@ """Interface for list storage, deleting, and finding.""" +from __future__ import absolute_import, unicode_literals + __metaclass__ = type __all__ = [ 'IListManager', diff --git a/mailman/interfaces/mailinglist.py b/mailman/interfaces/mailinglist.py index 970c1ac07..cd7b11d64 100644 --- a/mailman/interfaces/mailinglist.py +++ b/mailman/interfaces/mailinglist.py @@ -17,12 +17,16 @@ """Interface for a mailing list.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type __all__ = [ 'IMailingList', 'Personalization', 'ReplyToMunging', ] + from munepy import Enum from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/member.py b/mailman/interfaces/member.py index 697117219..2e966879d 100644 --- a/mailman/interfaces/member.py +++ b/mailman/interfaces/member.py @@ -17,6 +17,7 @@ """Interface describing the basics of a member.""" +from __future__ import absolute_import, unicode_literals __metaclass__ = type __all__ = [ @@ -78,7 +79,7 @@ class AlreadySubscribedError(SubscriptionError): self._role = role def __str__(self): - return '%s is already a %s of mailing list %s' % ( + return '{0} is already a {1} of mailing list {2}'.format( self._address, self._role, self._fqdn_listname) diff --git a/mailman/interfaces/messages.py b/mailman/interfaces/messages.py index 0da595d0b..72efe960f 100644 --- a/mailman/interfaces/messages.py +++ b/mailman/interfaces/messages.py @@ -17,6 +17,15 @@ """The message storage service.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IMessage', + 'IMessageStore', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/mlistrequest.py b/mailman/interfaces/mlistrequest.py index f348d617c..924421406 100644 --- a/mailman/interfaces/mlistrequest.py +++ b/mailman/interfaces/mlistrequest.py @@ -17,6 +17,14 @@ """Interface for a web request accessing a mailing list.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IMailingListRequest', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/mta.py b/mailman/interfaces/mta.py index 5e647cfb2..a8c794750 100644 --- a/mailman/interfaces/mta.py +++ b/mailman/interfaces/mta.py @@ -17,6 +17,8 @@ """Interface for mail transport agent integration.""" +from __future__ import absolute_import, unicode_literals + __metaclass__ = type __all__ = [ 'IMailTransportAgent', diff --git a/mailman/interfaces/pending.py b/mailman/interfaces/pending.py index 7fcde07ad..0e43278e0 100644 --- a/mailman/interfaces/pending.py +++ b/mailman/interfaces/pending.py @@ -22,6 +22,17 @@ maps these events to a unique hash that can be used as a token for end user confirmation. """ +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IPendable', + 'IPended', + 'IPendedKeyValue', + 'IPendings', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/permissions.py b/mailman/interfaces/permissions.py index fb36f35b5..7613064f5 100644 --- a/mailman/interfaces/permissions.py +++ b/mailman/interfaces/permissions.py @@ -17,6 +17,14 @@ """Interfaces for various permissions.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IPostingPermission', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/pipeline.py b/mailman/interfaces/pipeline.py index a95fb7628..0268693b7 100644 --- a/mailman/interfaces/pipeline.py +++ b/mailman/interfaces/pipeline.py @@ -17,6 +17,14 @@ """Interface for describing pipelines.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IPipeline', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/preferences.py b/mailman/interfaces/preferences.py index fbd81c801..9aeed8496 100644 --- a/mailman/interfaces/preferences.py +++ b/mailman/interfaces/preferences.py @@ -17,6 +17,14 @@ """Interface for preferences.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IPreferences', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/registrar.py b/mailman/interfaces/registrar.py index d6c174d85..d90966e2d 100644 --- a/mailman/interfaces/registrar.py +++ b/mailman/interfaces/registrar.py @@ -22,6 +22,8 @@ etc. than the IUserManager. The latter does no validation, syntax checking, or confirmation, while this interface does. """ +from __future__ import absolute_import, unicode_literals + __metaclass__ = type __all__ = [ 'IRegistrar', diff --git a/mailman/interfaces/requests.py b/mailman/interfaces/requests.py index b9c0802f4..e3e316fa0 100644 --- a/mailman/interfaces/requests.py +++ b/mailman/interfaces/requests.py @@ -21,6 +21,16 @@ The request database handles events that must be approved by the list moderators, such as subscription requests and held messages. """ +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IListRequests', + 'IRequests', + 'RequestType', + ] + + from munepy import Enum from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/roster.py b/mailman/interfaces/roster.py index f7b2125fd..9fb648be1 100644 --- a/mailman/interfaces/roster.py +++ b/mailman/interfaces/roster.py @@ -17,6 +17,14 @@ """Interface for a roster of members.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IRoster', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/rules.py b/mailman/interfaces/rules.py index 24501848f..632cc85de 100644 --- a/mailman/interfaces/rules.py +++ b/mailman/interfaces/rules.py @@ -17,6 +17,14 @@ """Interface describing the basics of rules.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IRule', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/runner.py b/mailman/interfaces/runner.py index 500efd541..e923e099b 100644 --- a/mailman/interfaces/runner.py +++ b/mailman/interfaces/runner.py @@ -17,6 +17,14 @@ """Interface for queue runners.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IRunner', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/styles.py b/mailman/interfaces/styles.py index 7cc0e50e8..e70050f02 100644 --- a/mailman/interfaces/styles.py +++ b/mailman/interfaces/styles.py @@ -17,6 +17,8 @@ """Interfaces for list styles.""" +from __future__ import absolute_import, unicode_literals + __metaclass__ = type __all__ = [ 'DuplicateStyleError', diff --git a/mailman/interfaces/switchboard.py b/mailman/interfaces/switchboard.py index 96cf1aea2..866093d12 100644 --- a/mailman/interfaces/switchboard.py +++ b/mailman/interfaces/switchboard.py @@ -17,6 +17,14 @@ """Interface for switchboards.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'ISwitchboard', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/user.py b/mailman/interfaces/user.py index 8824a2d7c..5c3ff58cd 100644 --- a/mailman/interfaces/user.py +++ b/mailman/interfaces/user.py @@ -17,6 +17,14 @@ """Interface describing the basics of a user.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IUser', + ] + + from zope.interface import Interface, Attribute diff --git a/mailman/interfaces/usermanager.py b/mailman/interfaces/usermanager.py index 7454faea8..41bec49ba 100644 --- a/mailman/interfaces/usermanager.py +++ b/mailman/interfaces/usermanager.py @@ -17,6 +17,14 @@ """Interface describing a user manager service.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'IUserManager', + ] + + from zope.interface import Interface, Attribute |
