summaryrefslogtreecommitdiff
path: root/src/mailman/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/handlers')
-rw-r--r--src/mailman/handlers/acknowledge.py8
-rw-r--r--src/mailman/handlers/after_delivery.py6
-rw-r--r--src/mailman/handlers/avoid_duplicates.py6
-rw-r--r--src/mailman/handlers/cleanse.py6
-rw-r--r--src/mailman/handlers/cleanse_dkim.py6
-rw-r--r--src/mailman/handlers/cook_headers.py13
-rw-r--r--src/mailman/handlers/decorate.py3
-rw-r--r--src/mailman/handlers/file_recipients.py6
-rw-r--r--src/mailman/handlers/member_recipients.py6
-rw-r--r--src/mailman/handlers/mime_delete.py8
-rw-r--r--src/mailman/handlers/owner_recipients.py6
-rw-r--r--src/mailman/handlers/replybot.py8
-rw-r--r--src/mailman/handlers/rfc_2369.py6
-rw-r--r--src/mailman/handlers/subject_prefix.py3
-rw-r--r--src/mailman/handlers/tagger.py6
-rw-r--r--src/mailman/handlers/tests/test_cook_headers.py7
-rw-r--r--src/mailman/handlers/tests/test_file_recips.py3
-rw-r--r--src/mailman/handlers/tests/test_filter.py3
-rw-r--r--src/mailman/handlers/tests/test_mimedel.py6
-rw-r--r--src/mailman/handlers/tests/test_recipients.py3
-rw-r--r--src/mailman/handlers/tests/test_subject_prefix.py3
-rw-r--r--src/mailman/handlers/tests/test_to_digest.py3
-rw-r--r--src/mailman/handlers/to_archive.py6
-rw-r--r--src/mailman/handlers/to_digest.py6
-rw-r--r--src/mailman/handlers/to_outgoing.py6
-rw-r--r--src/mailman/handlers/to_usenet.py8
26 files changed, 27 insertions, 124 deletions
diff --git a/src/mailman/handlers/acknowledge.py b/src/mailman/handlers/acknowledge.py
index bd8b8861d..c10043981 100644
--- a/src/mailman/handlers/acknowledge.py
+++ b/src/mailman/handlers/acknowledge.py
@@ -20,23 +20,19 @@
This only happens if the sender has set their AcknowledgePosts attribute.
"""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'Acknowledge',
]
-from zope.component import getUtility
-from zope.interface import implementer
-
from mailman.core.i18n import _
from mailman.email.message import UserNotification
from mailman.interfaces.handler import IHandler
from mailman.interfaces.languages import ILanguageManager
from mailman.utilities.i18n import make
from mailman.utilities.string import oneline
+from zope.component import getUtility
+from zope.interface import implementer
diff --git a/src/mailman/handlers/after_delivery.py b/src/mailman/handlers/after_delivery.py
index 7fa7a4554..464fafd8c 100644
--- a/src/mailman/handlers/after_delivery.py
+++ b/src/mailman/handlers/after_delivery.py
@@ -17,19 +17,15 @@
"""Perform some bookkeeping after a successful post."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'AfterDelivery',
]
-from zope.interface import implementer
-
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
from mailman.utilities.datetime import now
+from zope.interface import implementer
diff --git a/src/mailman/handlers/avoid_duplicates.py b/src/mailman/handlers/avoid_duplicates.py
index 529a99f68..636a9f24d 100644
--- a/src/mailman/handlers/avoid_duplicates.py
+++ b/src/mailman/handlers/avoid_duplicates.py
@@ -23,19 +23,15 @@ has already received a copy, we either drop the message, add a duplicate
warning header, or pass it through, depending on the user's preferences.
"""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'AvoidDuplicates',
]
from email.utils import getaddresses, formataddr
-from zope.interface import implementer
-
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
+from zope.interface import implementer
COMMASPACE = ', '
diff --git a/src/mailman/handlers/cleanse.py b/src/mailman/handlers/cleanse.py
index 6b653bb34..0dad3077e 100644
--- a/src/mailman/handlers/cleanse.py
+++ b/src/mailman/handlers/cleanse.py
@@ -17,9 +17,6 @@
"""Cleanse certain headers from all messages."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'Cleanse',
]
@@ -28,11 +25,10 @@ __all__ = [
import logging
from email.utils import formataddr
-from zope.interface import implementer
-
from mailman.core.i18n import _
from mailman.handlers.cook_headers import uheader
from mailman.interfaces.handler import IHandler
+from zope.interface import implementer
log = logging.getLogger('mailman.post')
diff --git a/src/mailman/handlers/cleanse_dkim.py b/src/mailman/handlers/cleanse_dkim.py
index 225666bf1..a4c16d31e 100644
--- a/src/mailman/handlers/cleanse_dkim.py
+++ b/src/mailman/handlers/cleanse_dkim.py
@@ -25,20 +25,16 @@ and it will also give the MTA the opportunity to regenerate valid keys
originating at the Mailman server for the outgoing message.
"""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'CleanseDKIM',
]
from lazr.config import as_boolean
-from zope.interface import implementer
-
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
+from zope.interface import implementer
diff --git a/src/mailman/handlers/cook_headers.py b/src/mailman/handlers/cook_headers.py
index f37e8f0e2..44ef02e36 100644
--- a/src/mailman/handlers/cook_headers.py
+++ b/src/mailman/handlers/cook_headers.py
@@ -17,9 +17,6 @@
"""Cook a message's headers."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'CookHeaders',
]
@@ -29,18 +26,16 @@ import re
from email.header import Header
from email.utils import parseaddr, formataddr, getaddresses
-from zope.interface import implementer
-
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
from mailman.interfaces.mailinglist import Personalization, ReplyToMunging
from mailman.version import VERSION
+from zope.interface import implementer
COMMASPACE = ', '
MAXLINELEN = 78
-
-nonascii = re.compile('[^\s!-~]')
+NONASCII = re.compile('[^\s!-~]')
@@ -53,12 +48,12 @@ def uheader(mlist, s, header_name=None, continuation_ws='\t', maxlinelen=None):
specified.
"""
charset = mlist.preferred_language.charset
- if nonascii.search(s):
+ if NONASCII.search(s):
# use list charset but ...
if charset == 'us-ascii':
charset = 'iso-8859-1'
else:
- # there is no nonascii so ...
+ # there is no non-ascii so ...
charset = 'us-ascii'
return Header(s, charset, maxlinelen, header_name, continuation_ws)
diff --git a/src/mailman/handlers/decorate.py b/src/mailman/handlers/decorate.py
index 03f0c009f..78fafb3ca 100644
--- a/src/mailman/handlers/decorate.py
+++ b/src/mailman/handlers/decorate.py
@@ -17,9 +17,6 @@
"""Decorate a message by sticking the header and footer around it."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'Decorate',
'decorate',
diff --git a/src/mailman/handlers/file_recipients.py b/src/mailman/handlers/file_recipients.py
index ec8868649..4b115bb53 100644
--- a/src/mailman/handlers/file_recipients.py
+++ b/src/mailman/handlers/file_recipients.py
@@ -17,9 +17,6 @@
"""Get the normal delivery recipients from a Sendmail style :include: file."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'FileRecipients',
]
@@ -28,10 +25,9 @@ __all__ = [
import os
import errno
-from zope.interface import implementer
-
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
+from zope.interface import implementer
diff --git a/src/mailman/handlers/member_recipients.py b/src/mailman/handlers/member_recipients.py
index 0f99bf709..7497746eb 100644
--- a/src/mailman/handlers/member_recipients.py
+++ b/src/mailman/handlers/member_recipients.py
@@ -23,22 +23,18 @@ on the `recipients' attribute of the message. This attribute is used by the
SendmailDeliver and BulkDeliver modules.
"""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'MemberRecipients',
]
-from zope.interface import implementer
-
from mailman.config import config
from mailman.core import errors
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
from mailman.interfaces.member import DeliveryStatus
from mailman.utilities.string import wrap
+from zope.interface import implementer
diff --git a/src/mailman/handlers/mime_delete.py b/src/mailman/handlers/mime_delete.py
index b5c937fdb..1d107522d 100644
--- a/src/mailman/handlers/mime_delete.py
+++ b/src/mailman/handlers/mime_delete.py
@@ -24,9 +24,6 @@ wrapping only single sections after other processing are replaced by their
contents.
"""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'MIMEDelete',
]
@@ -41,9 +38,6 @@ from email.iterators import typed_subpart_iterator
from email.mime.message import MIMEMessage
from email.mime.text import MIMEText
from lazr.config import as_boolean
-from os.path import splitext
-from zope.interface import implementer
-
from mailman.config import config
from mailman.core import errors
from mailman.core.i18n import _
@@ -52,6 +46,8 @@ from mailman.interfaces.action import FilterAction
from mailman.interfaces.handler import IHandler
from mailman.utilities.string import oneline
from mailman.version import VERSION
+from os.path import splitext
+from zope.interface import implementer
log = logging.getLogger('mailman.error')
diff --git a/src/mailman/handlers/owner_recipients.py b/src/mailman/handlers/owner_recipients.py
index 5a1d0bd2e..dbb203728 100644
--- a/src/mailman/handlers/owner_recipients.py
+++ b/src/mailman/handlers/owner_recipients.py
@@ -17,20 +17,16 @@
"""Calculate the list owner recipients (includes moderators)."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'OwnerRecipients',
]
-from zope.interface import implementer
-
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
from mailman.interfaces.member import DeliveryStatus
+from zope.interface import implementer
diff --git a/src/mailman/handlers/replybot.py b/src/mailman/handlers/replybot.py
index 63f3ca4cf..44df2344e 100644
--- a/src/mailman/handlers/replybot.py
+++ b/src/mailman/handlers/replybot.py
@@ -17,9 +17,6 @@
"""Handler for automatic responses."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'Replybot',
]
@@ -27,9 +24,6 @@ __all__ = [
import logging
-from zope.component import getUtility
-from zope.interface import implementer
-
from mailman.core.i18n import _
from mailman.email.message import UserNotification
from mailman.interfaces.autorespond import (
@@ -38,6 +32,8 @@ from mailman.interfaces.handler import IHandler
from mailman.interfaces.usermanager import IUserManager
from mailman.utilities.datetime import today
from mailman.utilities.string import expand, wrap
+from zope.component import getUtility
+from zope.interface import implementer
log = logging.getLogger('mailman.error')
diff --git a/src/mailman/handlers/rfc_2369.py b/src/mailman/handlers/rfc_2369.py
index ea909f41b..c835f2a67 100644
--- a/src/mailman/handlers/rfc_2369.py
+++ b/src/mailman/handlers/rfc_2369.py
@@ -17,22 +17,18 @@
"""RFC 2369 List-* and related headers."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'RFC2369',
]
from email.utils import formataddr
-from zope.interface import implementer
-
from mailman.core.i18n import _
from mailman.handlers.cook_headers import uheader
from mailman.interfaces.archiver import ArchivePolicy
from mailman.interfaces.mailinglist import IListArchiverSet
from mailman.interfaces.handler import IHandler
+from zope.interface import implementer
CONTINUATION = ',\n\t'
diff --git a/src/mailman/handlers/subject_prefix.py b/src/mailman/handlers/subject_prefix.py
index ee1921ac2..20abd1036 100644
--- a/src/mailman/handlers/subject_prefix.py
+++ b/src/mailman/handlers/subject_prefix.py
@@ -17,9 +17,6 @@
"""Subject header prefix munging."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'SubjectPrefix',
]
diff --git a/src/mailman/handlers/tagger.py b/src/mailman/handlers/tagger.py
index 51ff6b39e..199c5907f 100644
--- a/src/mailman/handlers/tagger.py
+++ b/src/mailman/handlers/tagger.py
@@ -17,9 +17,6 @@
"""Extract topics from the original mail message."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'Tagger',
]
@@ -29,10 +26,9 @@ import re
import email.iterators
import email.parser
-from zope.interface import implementer
-
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
+from zope.interface import implementer
OR = '|'
diff --git a/src/mailman/handlers/tests/test_cook_headers.py b/src/mailman/handlers/tests/test_cook_headers.py
index d83a44f20..385f402c5 100644
--- a/src/mailman/handlers/tests/test_cook_headers.py
+++ b/src/mailman/handlers/tests/test_cook_headers.py
@@ -17,9 +17,6 @@
"""Test the cook_headers handler."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'TestCookHeaders',
]
@@ -50,6 +47,6 @@ class TestCookHeaders(unittest.TestCase):
for msg in messages:
try:
cook_headers.process(self._mlist, msg, {})
- except AttributeError as e:
+ except AttributeError as error:
# LP: #1130696 would raise an AttributeError on .sender
- self.fail(e)
+ self.fail(error)
diff --git a/src/mailman/handlers/tests/test_file_recips.py b/src/mailman/handlers/tests/test_file_recips.py
index 9f3e0ec6e..906530762 100644
--- a/src/mailman/handlers/tests/test_file_recips.py
+++ b/src/mailman/handlers/tests/test_file_recips.py
@@ -17,9 +17,6 @@
"""Test file-recips handler."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'TestFileRecips',
]
diff --git a/src/mailman/handlers/tests/test_filter.py b/src/mailman/handlers/tests/test_filter.py
index 292e646cd..b81744008 100644
--- a/src/mailman/handlers/tests/test_filter.py
+++ b/src/mailman/handlers/tests/test_filter.py
@@ -17,9 +17,6 @@
"""Test the filter handler."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'TestFilters',
]
diff --git a/src/mailman/handlers/tests/test_mimedel.py b/src/mailman/handlers/tests/test_mimedel.py
index c7c37152f..02cb275e0 100644
--- a/src/mailman/handlers/tests/test_mimedel.py
+++ b/src/mailman/handlers/tests/test_mimedel.py
@@ -17,9 +17,6 @@
"""Test the mime_delete handler."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'TestDispose',
]
@@ -27,8 +24,6 @@ __all__ = [
import unittest
-from zope.component import getUtility
-
from mailman.app.lifecycle import create_list
from mailman.config import config
from mailman.core import errors
@@ -40,6 +35,7 @@ from mailman.testing.helpers import (
LogFileMark, configuration, get_queue_messages,
specialized_message_from_string as mfs)
from mailman.testing.layers import ConfigLayer
+from zope.component import getUtility
diff --git a/src/mailman/handlers/tests/test_recipients.py b/src/mailman/handlers/tests/test_recipients.py
index ef2021d2c..688dcce04 100644
--- a/src/mailman/handlers/tests/test_recipients.py
+++ b/src/mailman/handlers/tests/test_recipients.py
@@ -17,9 +17,6 @@
"""Testing various recipients stuff."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'TestMemberRecipients',
'TestOwnerRecipients',
diff --git a/src/mailman/handlers/tests/test_subject_prefix.py b/src/mailman/handlers/tests/test_subject_prefix.py
index 1125f3811..f4fd8c113 100644
--- a/src/mailman/handlers/tests/test_subject_prefix.py
+++ b/src/mailman/handlers/tests/test_subject_prefix.py
@@ -17,9 +17,6 @@
"""Test the Subject header prefix munging.."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'TestSubjectPrefix',
]
diff --git a/src/mailman/handlers/tests/test_to_digest.py b/src/mailman/handlers/tests/test_to_digest.py
index 451ebf9a5..8562c3fd7 100644
--- a/src/mailman/handlers/tests/test_to_digest.py
+++ b/src/mailman/handlers/tests/test_to_digest.py
@@ -17,9 +17,6 @@
"""Test the to_digest handler."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'TestToDigest',
]
diff --git a/src/mailman/handlers/to_archive.py b/src/mailman/handlers/to_archive.py
index d18742f3c..d8c61bc7d 100644
--- a/src/mailman/handlers/to_archive.py
+++ b/src/mailman/handlers/to_archive.py
@@ -17,20 +17,16 @@
"""Add the message to the archives."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'ToArchive',
]
-from zope.interface import implementer
-
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.archiver import ArchivePolicy
from mailman.interfaces.handler import IHandler
+from zope.interface import implementer
diff --git a/src/mailman/handlers/to_digest.py b/src/mailman/handlers/to_digest.py
index e2d6657b7..70aeb0dcc 100644
--- a/src/mailman/handlers/to_digest.py
+++ b/src/mailman/handlers/to_digest.py
@@ -17,9 +17,6 @@
"""Add the message to the list's current digest."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'ToDigest',
]
@@ -27,8 +24,6 @@ __all__ = [
import os
-from zope.interface import implementer
-
from mailman.config import config
from mailman.core.i18n import _
from mailman.email.message import Message
@@ -36,6 +31,7 @@ from mailman.interfaces.digests import DigestFrequency
from mailman.interfaces.handler import IHandler
from mailman.utilities.datetime import now as right_now
from mailman.utilities.mailbox import Mailbox
+from zope.interface import implementer
diff --git a/src/mailman/handlers/to_outgoing.py b/src/mailman/handlers/to_outgoing.py
index 92fb7fee0..95686d9c7 100644
--- a/src/mailman/handlers/to_outgoing.py
+++ b/src/mailman/handlers/to_outgoing.py
@@ -22,19 +22,15 @@ posted to the list membership. Anything else that needs to go out to some
recipient should just be placed in the out queue directly.
"""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'ToOutgoing',
]
-from zope.interface import implementer
-
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
+from zope.interface import implementer
diff --git a/src/mailman/handlers/to_usenet.py b/src/mailman/handlers/to_usenet.py
index 28c18c520..8d86ea86e 100644
--- a/src/mailman/handlers/to_usenet.py
+++ b/src/mailman/handlers/to_usenet.py
@@ -17,9 +17,6 @@
"""Move the message to the mail->news queue."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'ToUsenet',
]
@@ -27,14 +24,13 @@ __all__ = [
import logging
-from zope.interface import implementer
-
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
+from zope.interface import implementer
-COMMASPACE = ', '
+COMMASPACE = ', '
log = logging.getLogger('mailman.error')