[Spambayes-checkins] spambayes/scripts sb_mboxtrain.py,1.11,1.12

Tony Meyer anadelonbrin at users.sourceforge.net
Tue May 25 19:16:42 EDT 2004


Update of /cvsroot/spambayes/spambayes/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19010/scripts

Modified Files:
	sb_mboxtrain.py 
Log Message:
Add a comment to mboxutils.

mboxtrain is the last (I think) script that still gets hit by the TypeError problem, so fix that.
For the moment, this fix is just to apply the fix that Skip made for sb_filter - i.e. instead
of calling msg.as_string(), we call mboxutils.as_string(msg).

I can't see how this would break anything, unless the mboxutils.as_string code is broken,
which is already in 1.0, so this seems to be a good bugfix candidate.

Closes [ 942262 ] TypeError: string payload expected: <type 'list'>

Index: sb_mboxtrain.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_mboxtrain.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** sb_mboxtrain.py	5 Feb 2004 08:13:26 -0000	1.11
--- sb_mboxtrain.py	25 May 2004 23:16:39 -0000	1.12
***************
*** 51,55 ****
  import sys, os, getopt, email
  import shutil
! from spambayes import hammie, storage
  from spambayes.Options import options, get_pathname_option
  
--- 51,55 ----
  import sys, os, getopt, email
  import shutil
! from spambayes import hammie, storage, mboxutils
  from spambayes.Options import options, get_pathname_option
  
***************
*** 83,87 ****
      # multipart/alternative?
      try:
!         msg.as_string()
      except TypeError:
          # We'll be unable to represent this as text :(
--- 83,87 ----
      # multipart/alternative?
      try:
!         mboxutils.as_string(msg)
      except TypeError:
          # We'll be unable to represent this as text :(
***************
*** 145,149 ****
              continue
          f = file(tfn, "wb")
!         f.write(msg.as_string())
          f.close()
          shutil.copystat(cfn, tfn)
--- 145,149 ----
              continue
          f = file(tfn, "wb")
!         f.write(mboxutils.as_string(msg))
          f.close()
          shutil.copystat(cfn, tfn)
***************
*** 190,194 ****
          if options["Headers", "include_trained"]:
              # Write it out with the Unix "From " line
!             outf.write(msg.as_string(True))
  
      if options["Headers", "include_trained"]:
--- 190,194 ----
          if options["Headers", "include_trained"]:
              # Write it out with the Unix "From " line
!             outf.write(mboxutils.as_string(msg, True))
  
      if options["Headers", "include_trained"]:
***************
*** 246,250 ****
              continue
          f = file(tfn, "wb")
!         f.write(msg.as_string())
          f.close()
          shutil.copystat(cfn, tfn)
--- 246,250 ----
              continue
          f = file(tfn, "wb")
!         f.write(mboxutils.as_string(msg))
          f.close()
          shutil.copystat(cfn, tfn)




More information about the Spambayes-checkins mailing list