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

SourceForge.net noreply at sourceforge.net
Wed Nov 5 19:37:09 EST 2003


Patches item #836922, was opened at 2003-11-05 16:37
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498105&aid=836922&group_id=61702

Category: None
Group: None
Status: Open
Resolution: None
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)



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

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