diff options
Diffstat (limited to 'mailman/core')
| -rw-r--r-- | mailman/core/chains.py | 9 | ||||
| -rw-r--r-- | mailman/core/errors.py | 28 | ||||
| -rw-r--r-- | mailman/core/initialize.py | 11 | ||||
| -rw-r--r-- | mailman/core/logging.py | 7 | ||||
| -rw-r--r-- | mailman/core/pipelines.py | 6 | ||||
| -rw-r--r-- | mailman/core/plugins.py | 15 | ||||
| -rw-r--r-- | mailman/core/rules.py | 5 |
7 files changed, 68 insertions, 13 deletions
diff --git a/mailman/core/chains.py b/mailman/core/chains.py index 58935ed39..40b8c779f 100644 --- a/mailman/core/chains.py +++ b/mailman/core/chains.py @@ -17,6 +17,8 @@ """Application support for chain processing.""" +from __future__ import absolute_import, unicode_literals + __metaclass__ = type __all__ = [ 'initialize', @@ -56,7 +58,7 @@ def process(mlist, msg, msgdata, start_chain='built-in'): # we can capture a chain's link iterator in mid-flight. This supports # the 'detour' link action try: - link = chain_iter.next() + link = next(chain_iter) except StopIteration: # This chain is exhausted. Pop the last chain on the stack and # continue iterating through it. If there's nothing left on the @@ -90,7 +92,8 @@ def process(mlist, msg, msgdata, start_chain='built-in'): elif link.action is LinkAction.run: link.function(mlist, msg, msgdata) else: - raise AssertionError('Bad link action: %s' % link.action) + raise AssertionError( + 'Bad link action: {0}'.format(link.action)) else: # The rule did not match; keep going. if link.rule.record: @@ -103,7 +106,7 @@ def initialize(): for chain_class in (DiscardChain, HoldChain, RejectChain, AcceptChain): chain = chain_class() assert chain.name not in config.chains, ( - 'Duplicate chain name: %s' % chain.name) + 'Duplicate chain name: {0}'.format(chain.name)) config.chains[chain.name] = chain # Set up a couple of other default chains. chain = BuiltInChain() diff --git a/mailman/core/errors.py b/mailman/core/errors.py index 51803ae79..39401127e 100644 --- a/mailman/core/errors.py +++ b/mailman/core/errors.py @@ -17,6 +17,34 @@ """Mailman errors.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'AlreadyReceivingDigests', + 'AlreadyReceivingRegularDeliveries', + 'BadDomainSpecificationError', + 'BadPasswordSchemeError', + 'CantDigestError', + 'DiscardMessage', + 'EmailAddressError', + 'HandlerError', + 'HoldMessage', + 'HostileSubscriptionError', + 'InvalidEmailAddress', + 'LostHeldMessage', + 'MailmanError', + 'MailmanException', + 'MemberError', + 'MembershipIsBanned', + 'MustDigestError', + 'NotAMemberError', + 'PasswordError', + 'RejectMessage', + 'SomeRecipientsFailed', + 'SubscriptionError', + ] + # Base class for all exceptions raised in Mailman (XXX except legacy string diff --git a/mailman/core/initialize.py b/mailman/core/initialize.py index c8b457d75..bb16f0036 100644 --- a/mailman/core/initialize.py +++ b/mailman/core/initialize.py @@ -24,6 +24,17 @@ line argument parsing, since some of the initialization behavior is controlled by the command line arguments. """ +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'initialize', + 'initialize_1', + 'initialize_2', + 'initialize_3', + ] + + import os from zope.interface.interface import adapter_hooks diff --git a/mailman/core/logging.py b/mailman/core/logging.py index 43abac78d..a18065965 100644 --- a/mailman/core/logging.py +++ b/mailman/core/logging.py @@ -17,7 +17,7 @@ """Logging initialization, using Python's standard logging package.""" -from __future__ import absolute_import +from __future__ import absolute_import, unicode_literals __metaclass__ = type __all__ = [ @@ -74,11 +74,10 @@ class ReopenableFileHandler(logging.Handler): stream = (self._stream if self._stream else sys.stderr) try: msg = self.format(record) - fs = '%s\n' try: - stream.write(fs % msg) + stream.write('{0}'.format(msg)) except UnicodeError: - stream.write(fs % msg.encode('string-escape')) + stream.write('{0}'.format(msg.encode('string-escape'))) self.flush() except: self.handleError(record) diff --git a/mailman/core/pipelines.py b/mailman/core/pipelines.py index 7be252388..8aae5cc25 100644 --- a/mailman/core/pipelines.py +++ b/mailman/core/pipelines.py @@ -17,6 +17,8 @@ """Pipeline processor.""" +from __future__ import absolute_import, unicode_literals + __metaclass__ = type __all__ = [ 'initialize', @@ -114,8 +116,8 @@ def initialize(): handler = handler_class() verifyObject(IHandler, handler) assert handler.name not in config.handlers, ( - 'Duplicate handler "%s" found in %s' % - (handler.name, handler_finder)) + 'Duplicate handler "{0}" found in {1}'.format( + handler.name, handler_finder)) config.handlers[handler.name] = handler # Set up some pipelines. for pipeline_class in (BuiltInPipeline, VirginPipeline): diff --git a/mailman/core/plugins.py b/mailman/core/plugins.py index cce95fddd..e9ba26571 100644 --- a/mailman/core/plugins.py +++ b/mailman/core/plugins.py @@ -17,6 +17,13 @@ """Get a requested plugin.""" +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + ] + + import pkg_resources @@ -36,7 +43,8 @@ def get_plugin(group): """ entry_points = list(pkg_resources.iter_entry_points(group)) if len(entry_points) == 0: - raise RuntimeError('No entry points found for group: %s' % group) + raise RuntimeError( + 'No entry points found for group: {0}'.format(group)) elif len(entry_points) == 1: # Okay, this is the one to use. return entry_points[0].load() @@ -44,14 +52,15 @@ def get_plugin(group): # Find the one /not/ named 'stock'. entry_points = [ep for ep in entry_points if ep.name <> 'stock'] if len(entry_points) == 0: - raise RuntimeError('No stock plugin found for group: %s' % group) + raise RuntimeError( + 'No stock plugin found for group: {0}'.format(group)) elif len(entry_points) == 2: raise RuntimeError('Too many stock plugins defined') else: raise AssertionError('Insanity') return entry_points[0].load() else: - raise RuntimeError('Too many plugins for group: %s' % group) + raise RuntimeError('Too many plugins for group: {0}'.format(group)) diff --git a/mailman/core/rules.py b/mailman/core/rules.py index e272846d3..83e24dfa2 100644 --- a/mailman/core/rules.py +++ b/mailman/core/rules.py @@ -17,6 +17,8 @@ """Various rule helpers""" +from __future__ import absolute_import, unicode_literals + __metaclass__ = type __all__ = [ 'initialize', @@ -39,5 +41,6 @@ def initialize(): rule = rule_class() verifyObject(IRule, rule) assert rule.name not in config.rules, ( - 'Duplicate rule "%s" found in %s' % (rule.name, rule_finder)) + 'Duplicate rule "{0}" found in {1}'.format( + rule.name, rule_finder)) config.rules[rule.name] = rule |
