[spambayes-bugs] [ spambayes-Patches-836922 ] sb_mboxtrain include_trained mbox fix

SourceForge.net noreply at sourceforge.net
Wed Oct 13 04:57:22 CEST 2004


Patches item #836922, was opened at 2003-11-06 13:37
Message generated for change (Comment added) made by anadelonbrin
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498105&aid=836922&group_id=61702

Category: None
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: John Hazen (jhazen)
Assigned to: Nobody/Anonymous (nobody)
Summary: sb_mboxtrain include_trained mbox fix

Initial Comment:
Version:  SB 1.0a6

When dealing with mbox files, it looks like the
processing for the 'include_trained' option is incorrect.

I found this when training repeatedly on the same ham
and spam files, and seeing that all messages were being
added to the database repeatedly.  Then I saw that the
'X-Spambayes-Trained:' header had not been added to the
files.

After looking at Options.options, I believe the correct
solution is to change the processing of mbox files, as
'include_trained' defaults to true, and I have not
unset it.

The patch below fixed the problem for me.  Let me know
if you need any further information.  This is my first
patch on SF, so I'm not sure it will send me email. 
You can reach me directly at (john at hazendotnet).

(In case this context isn't clear, the two "not"s are
removed in mbox_train.)

gate2:scripts$ diff -c sb_mboxtrain.py sb_mboxtrain.jsh.py 
*** sb_mboxtrain.py     Thu Sep 18 08:36:30 2003
--- sb_mboxtrain.jsh.py Wed Nov  5 16:03:01 2003
***************
*** 157,167 ****
              sys.stdout.flush()
          if msg_train(h, msg, is_spam, force):
              trained += 1
!         if not options["Headers", "include_trained"]:
              # Write it out with the Unix "From " line
              outf.write(msg.as_string(True))
  
!     if not options["Headers", "include_trained"]:
          outf.seek(0)
          try:
              os.ftruncate(f.fileno(), 0)
--- 157,167 ----
              sys.stdout.flush()
          if msg_train(h, msg, is_spam, force):
              trained += 1
!         if options["Headers", "include_trained"]:
              # Write it out with the Unix "From " line
              outf.write(msg.as_string(True))
  
!     if options["Headers", "include_trained"]:
          outf.seek(0)
          try:
              os.ftruncate(f.fileno(), 0)



----------------------------------------------------------------------

>Comment By: Tony Meyer (anadelonbrin)
Date: 2004-10-13 15:57

Message:
Logged In: YES 
user_id=552329

This was fixed in revision 1.6 of sb_mboxtrain.  Apologies
for not indicating this here before now!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498105&aid=836922&group_id=61702


More information about the Spambayes-bugs mailing list