Update of /cvsroot/mailman/mailman/Mailman
In directory usw-pr-cvs1:/tmp/cvs-serv23017

Modified Files:
        ListAdmin.py 
Log Message:
__handlepost(): Preserved messages should be written out as plain
text, not as pickles.


Index: ListAdmin.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/ListAdmin.py,v
retrieving revision 2.35
retrieving revision 2.36
diff -C2 -d -r2.35 -r2.36
*** ListAdmin.py        1 Apr 2002 19:07:48 -0000       2.35
--- ListAdmin.py        4 Apr 2002 23:12:51 -0000       2.36
***************
*** 252,261 ****
              parts[0] = 'spam'
              spamfile = DASH.join(parts)
!             import shutil
              try:
!                 shutil.copy(path, os.path.join(mm_cfg.SPAM_DIR, spamfile))
              except IOError, e:
                  if e.errno <> errno.ENOENT: raise
                  return LOST
          # Now handle updates to the database
          rejection = None
--- 252,275 ----
              parts[0] = 'spam'
              spamfile = DASH.join(parts)
!             # Preserve the message as plain text, not as a pickle
              try:
!                 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



_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins

Reply via email to