diff options
| author | jhylton | 2000-09-22 20:32:42 +0000 |
|---|---|---|
| committer | jhylton | 2000-09-22 20:32:42 +0000 |
| commit | 1970b29baf84bdea46ba791e4d6fa81d166cf86f (patch) | |
| tree | f26dfb70d62d9d1556651ea3d0b7d4be90652e35 /Mailman/Archiver/pipermail.py | |
| parent | 327e563a2576ae52468d8001afb14c599ac2de26 (diff) | |
| download | mailman-1970b29baf84bdea46ba791e4d6fa81d166cf86f.tar.gz mailman-1970b29baf84bdea46ba791e4d6fa81d166cf86f.tar.zst mailman-1970b29baf84bdea46ba791e4d6fa81d166cf86f.zip | |
Diffstat (limited to 'Mailman/Archiver/pipermail.py')
| -rw-r--r-- | Mailman/Archiver/pipermail.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Mailman/Archiver/pipermail.py b/Mailman/Archiver/pipermail.py index 0cfe93ddd..211485501 100644 --- a/Mailman/Archiver/pipermail.py +++ b/Mailman/Archiver/pipermail.py @@ -1,5 +1,6 @@ #! /usr/bin/env python +import mailbox import os import re import sys @@ -20,6 +21,12 @@ __version__ = '0.05 (Mailman edition)' VERSION = __version__ CACHESIZE = 100 # Number of slots in the cache + +class FastUnixMailbox(mailbox.UnixMailbox): + _rx_fromline = re.compile(mailbox.UnixMailbox._fromlinepattern) + + def _isrealfromline(self, line): + return FastUnixMailbox._rx_fromline.match(line) msgid_pat = re.compile(r'(<.*>)') @@ -201,13 +208,8 @@ class Article: self.headers[i] = message[i] # Read the message body - self.body = [] message.rewindbody() - while 1: - line = message.fp.readline() - if line == "": - break - self.body.append(line) + self.body = message.fp.readlines() def _set_date(self, message): if message.has_key('Date'): @@ -505,9 +507,8 @@ class T: # object will then be archived. def processUnixMailbox(self, input, articleClass = Article): - import mailbox - mbox = mailbox.UnixMailbox(input) - while (1): + mbox = FastUnixMailbox(input) + while 1: m = mbox.next() if not m: break @@ -539,8 +540,6 @@ class T: article.filename = filename = self.get_filename(article) temp = self.format_article(article) - fmt = "Processing article #%s into archives %s: %s" - self.message(fmt % (article.sequence, archives, article.subject)) for arch in archives: self.archive = arch # why do this??? archivedir = os.path.join(self.basedir, arch) |
