summaryrefslogtreecommitdiff
path: root/Mailman/ListAdmin.py
diff options
context:
space:
mode:
authorbwarsaw2002-04-04 23:12:51 +0000
committerbwarsaw2002-04-04 23:12:51 +0000
commit0d17f935c592cab20364d64637bc00a325973507 (patch)
treefd2659d353a3e32f83944f650382789d43d97a73 /Mailman/ListAdmin.py
parentbc24af633b29d50b8ef9b5e54d7adb0bdb09ebcc (diff)
downloadmailman-0d17f935c592cab20364d64637bc00a325973507.tar.gz
mailman-0d17f935c592cab20364d64637bc00a325973507.tar.zst
mailman-0d17f935c592cab20364d64637bc00a325973507.zip
Diffstat (limited to 'Mailman/ListAdmin.py')
-rw-r--r--Mailman/ListAdmin.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/Mailman/ListAdmin.py b/Mailman/ListAdmin.py
index 867ea3ecd..781cc6d33 100644
--- a/Mailman/ListAdmin.py
+++ b/Mailman/ListAdmin.py
@@ -251,12 +251,26 @@ class ListAdmin:
parts = os.path.split(path)[1].split(DASH)
parts[0] = 'spam'
spamfile = DASH.join(parts)
- import shutil
+ # Preserve the message as plain text, not as a pickle
try:
- shutil.copy(path, os.path.join(mm_cfg.SPAM_DIR, spamfile))
+ fp = open(path)
except IOError, e:
if e.errno <> errno.ENOENT: raise
return LOST
+ try:
+ msg = cPickle.load(fp)
+ finally:
+ fp.close()
+ # Save the plain text to a .msg file, not a .pck file
+ outpath = os.path.join(mm_cfg.SPAM_DIR, spamfile)
+ head, ext = os.path.splitext(outpath)
+ outpath = head + '.msg'
+ outfp = open(outpath, 'w')
+ try:
+ g = Generator(outfp)
+ g(msg, 1)
+ finally:
+ outfp.close()
# Now handle updates to the database
rejection = None
fp = None