diff options
| author | bwarsaw | 2001-10-01 16:37:18 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-10-01 16:37:18 +0000 |
| commit | 2b4c93ce5af0297d0efbee3faa0168cc0a2c74b1 (patch) | |
| tree | 930d994010024c8d4deba2ab9a59241a58283e08 /Mailman/Handlers/Tagger.py | |
| parent | 96aec99f845af72c50a85ee562b3f1ce9e096114 (diff) | |
| download | mailman-2b4c93ce5af0297d0efbee3faa0168cc0a2c74b1.tar.gz mailman-2b4c93ce5af0297d0efbee3faa0168cc0a2c74b1.tar.zst mailman-2b4c93ce5af0297d0efbee3faa0168cc0a2c74b1.zip | |
Diffstat (limited to 'Mailman/Handlers/Tagger.py')
| -rw-r--r-- | Mailman/Handlers/Tagger.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Mailman/Handlers/Tagger.py b/Mailman/Handlers/Tagger.py index 27c178751..220dd884f 100644 --- a/Mailman/Handlers/Tagger.py +++ b/Mailman/Handlers/Tagger.py @@ -18,8 +18,8 @@ """ import re -from mimelib.Parser import Parser -from mimelib.MsgReader import MsgReader +import email +import email.Iterators from Mailman.Logging.Syslog import syslog @@ -80,11 +80,12 @@ def scanbody(msg, numlines=None): # Now that we have a Message object that meets our criteria, let's extract # the first numlines of body text. lines = [] - reader = MsgReader(msg) lineno = 0 + reader = email.Iterators.body_line_iterator(msg) while numlines is None or lineno < numlines: - line = reader.readline() - if not line: + try: + line = reader.pop(0) + except IndexError: break # Blank lines don't count if not line.strip(): @@ -95,7 +96,7 @@ def scanbody(msg, numlines=None): if line[0] not in ' \t' and line.find(':') < 0: break lines.append(line) - # Concatenate those body text lines with newlines, and then feed it to the - # mimelib message Parser - msg = Parser().parsestr(NL.join(lines)) + # Concatenate those body text lines with newlines, and then create a new + # message object from those lines. + msg = email.message_from_string(NL.join(lines)) return msg.getall('subject', []) + msg.getall('keywords', []) |
