[Spambayes] Suggested patch for sb_mboxtrain.py
Shawn Dyer
sdyer at dyermail.net
Mon Jan 26 02:06:38 EST 2004
When I ran sb_mboxtrain.py on my Maildir inbox, the timestamp on all of
the files was touched, which messed up the way Courier IMAP sorts by
receive date. Here is a suggested patch for sb_mboxtrain.py to preserve
the timestamps on the Maildir messages that it trains. I made it on my
local copy and can confirm that a training run will preserve the
timestamps on the original email files even when it adds the trained
header. The same technique would probably be useful for MHDir messages,
but I do not use that and so cannot test.
*** spambayes-1.0a7/scripts/sb_mboxtrain.py Tue Nov 4 04:02:40 2003
--- ../spambayes-1.0a7/scripts/sb_mboxtrain.py Mon Jan 26 00:53:02 2004
***************
*** 92,97 ****
--- 92,98 ----
import time
import socket
+ import shutil
pid = os.getpid()
host = socket.gethostname()
***************
*** 120,125 ****
--- 121,127 ----
f = file(tfn, "wb")
f.write(msg.as_string())
f.close()
+ shutil.copystat(cfn,tfn)
# XXX: This will raise an exception on Windows. Do any Windows
# people actually use Maildirs?
os.rename(tfn, cfn)
More information about the Spambayes
mailing list