summaryrefslogtreecommitdiff
path: root/src/mailman/handlers/tagger.py
diff options
context:
space:
mode:
authorBarry Warsaw2016-03-25 09:36:52 -0400
committerBarry Warsaw2016-03-25 09:36:52 -0400
commitb9c06627e46ff1e9f09965228ab3b48f217109af (patch)
treea600fa04dd2ac6d006b88aee2c5e605673629fa3 /src/mailman/handlers/tagger.py
parent49d630f2761175e404f3b1d811e61bc43eb6b25b (diff)
downloadmailman-b9c06627e46ff1e9f09965228ab3b48f217109af.tar.gz
mailman-b9c06627e46ff1e9f09965228ab3b48f217109af.tar.zst
mailman-b9c06627e46ff1e9f09965228ab3b48f217109af.zip
Diffstat (limited to 'src/mailman/handlers/tagger.py')
-rw-r--r--src/mailman/handlers/tagger.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/mailman/handlers/tagger.py b/src/mailman/handlers/tagger.py
index 50112c74f..fb0a24ba5 100644
--- a/src/mailman/handlers/tagger.py
+++ b/src/mailman/handlers/tagger.py
@@ -17,15 +17,11 @@
"""Extract topics from the original mail message."""
-__all__ = [
- 'Tagger',
- ]
-
-
import re
import email.iterators
import email.parser
+from mailman import public
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
from zope.interface import implementer
@@ -37,7 +33,6 @@ EMPTYSTRING = ''
NLTAB = '\n\t'
-
def process(mlist, msg, msgdata):
"""Tag the message for topics."""
if not mlist.topics_enabled:
@@ -75,7 +70,6 @@ def process(mlist, msg, msgdata):
msg['X-Topics'] = NLTAB.join(sorted(hits))
-
def scanbody(msg, numlines=None):
"""Scan the body for keywords."""
# We only scan the body of the message if it is of MIME type text/plain,
@@ -84,8 +78,8 @@ def scanbody(msg, numlines=None):
found = None
if msg.get_content_type() == 'text/plain':
found = msg
- elif msg.is_multipart()\
- and msg.get_content_type() == 'multipart/alternative':
+ elif (msg.is_multipart() and
+ msg.get_content_type() == 'multipart/alternative'):
for found in msg.get_payload():
if found.get_content_type() == 'text/plain':
break
@@ -115,7 +109,6 @@ def scanbody(msg, numlines=None):
return msg.get_all('subject', []) + msg.get_all('keywords', [])
-
class _ForgivingParser(email.parser.HeaderParser):
"""An lax email parser.
@@ -173,7 +166,7 @@ class _ForgivingParser(email.parser.HeaderParser):
container[lastheader] = NLTAB.join(lastvalue)
-
+@public
@implementer(IHandler)
class Tagger:
"""Tag messages with topic matches."""