diff options
| author | bwarsaw | 2001-10-01 16:30:10 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-10-01 16:30:10 +0000 |
| commit | 508f288b1ddca50dc579f9e218a332f225cc7725 (patch) | |
| tree | 9ec8da94e798508b6d58f460a6e38fc6d5b9c24d | |
| parent | aa441ecb4472f991912fa9e0fbeff2e1a3aa8bb6 (diff) | |
| download | mailman-508f288b1ddca50dc579f9e218a332f225cc7725.tar.gz mailman-508f288b1ddca50dc579f9e218a332f225cc7725.tar.zst mailman-508f288b1ddca50dc579f9e218a332f225cc7725.zip | |
Convert from mimelib to email.
Also, use cStringIO directly instead of our own hack-around StringIO
module.
admindb.py: Use ListAdmin.readMessage() to actually read the contents
of the message from disk.
| -rw-r--r-- | Mailman/Cgi/admin.py | 4 | ||||
| -rw-r--r-- | Mailman/Cgi/admindb.py | 21 |
2 files changed, 7 insertions, 18 deletions
diff --git a/Mailman/Cgi/admin.py b/Mailman/Cgi/admin.py index 78c9d4623..4d470b7f3 100644 --- a/Mailman/Cgi/admin.py +++ b/Mailman/Cgi/admin.py @@ -28,9 +28,7 @@ import signal from types import * from string import lowercase, digits -from mimelib.address import unquote -# WIBNI I could just import this from mimelib.address? -from Mailman.pythonlib.rfc822 import parseaddr +from email.Utils import unquote, parseaddr from Mailman import mm_cfg from Mailman import Utils diff --git a/Mailman/Cgi/admindb.py b/Mailman/Cgi/admindb.py index 60984a652..100bee068 100644 --- a/Mailman/Cgi/admindb.py +++ b/Mailman/Cgi/admindb.py @@ -22,10 +22,7 @@ import types import cgi import errno import signal - -from mimelib.Parser import Parser -from mimelib.MsgReader import MsgReader -import mimelib.Errors +import email from Mailman import mm_cfg from Mailman import Utils @@ -33,6 +30,7 @@ from Mailman import MailList from Mailman import Errors from Mailman import Message from Mailman import i18n +from Mailman.ListAdmin import readMessage from Mailman.Cgi import Auth from Mailman.htmlformat import * from Mailman.Logging.Syslog import syslog @@ -218,14 +216,11 @@ def show_post_requests(mlist, id, info, total, count, form): msg += _(' (%(count)d of %(total)d)') form.AddItem(Center(Header(2, msg))) # We need to get the headers and part of the textual body of the message - # being held. The best way to do this is to use the mimelib Parser to get + # being held. The best way to do this is to use the email Parser to get # an actual object, which will be easier to deal with. We probably could # just do raw reads on the file. - p = Parser(Message.Message) try: - fp = open(os.path.join(mm_cfg.DATA_DIR, filename)) - msg = p.parse(fp) - fp.close() + msg = readMessage(os.path.join(mm_cfg.DATA_DIR, filename)) except IOError, e: if e.errno <> errno.ENOENT: raise @@ -237,7 +232,7 @@ def show_post_requests(mlist, id, info, total, count, form): except Errors.LostHeldMessage: pass return - except mimelib.Errors.MessageParseError: + except email.Errors.MessageParseError: form.AddItem(_('<em>Message with id #%(id)d is corrupted.')) # BAW: Should we really delete this, or shuttle it off for site admin # to look more closely at? @@ -251,11 +246,7 @@ def show_post_requests(mlist, id, info, total, count, form): # Get the header text and the message body excerpt lines = [] chars = 0 - reader = MsgReader(msg) - while 1: - line = reader.readline() - if not line: - break + for line in email.Iterators.body_line_iterator(msg): lines.append(line) chars += len(line) if chars > mm_cfg.ADMINDB_PAGE_TEXT_LIMIT: |
