[Spambayes-checkins] spambayes/scripts sb_filter.py,1.2,1.3

Tony Meyer anadelonbrin at users.sourceforge.net
Wed Sep 24 02:53:39 EDT 2003


Update of /cvsroot/spambayes/spambayes/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv13444/scripts

Modified Files:
	sb_filter.py 
Log Message:
If the -n switch was before the -d/-p switch, then the name wouldn't be used.
This is rather unintuitive, so fix this so that the -d/-p name is used wherever
the -n switch is.

Index: sb_filter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_filter.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** sb_filter.py	10 Sep 2003 04:33:17 -0000	1.2
--- sb_filter.py	24 Sep 2003 06:53:36 -0000	1.3
***************
*** 53,56 ****
--- 53,62 ----
  from spambayes import hammie, Options, mboxutils
  
+ try:
+     True, False
+ except NameError:
+     # Maintain compatibility with Python 2.2
+     True, False = 1, 0
+ 
  # See Options.py for explanations of these properties
  program = sys.argv[0]
***************
*** 148,151 ****
--- 154,158 ----
      opts, args = getopt.getopt(sys.argv[1:], 'hxd:D:nfgstGS',
                                 ['help', 'examples'])
+     create_newdb = False
      for opt, arg in opts:
          if opt in ('-h', '--help'):
***************
*** 172,177 ****
              actions.append(h.untrain_spam)
          elif opt == "-n":
!             h.newdb()
!             sys.exit(0)
  
      if actions == []:
--- 179,187 ----
              actions.append(h.untrain_spam)
          elif opt == "-n":
!             create_newdb = True
! 
!     if create_newdb:
!         h.newdb()
!         sys.exit(0)
  
      if actions == []:





More information about the Spambayes-checkins mailing list