[Spambayes-checkins] spambayes/scripts sb_filter.py,1.18,1.19

Tony Meyer anadelonbrin at users.sourceforge.net
Fri Apr 7 04:25:30 CEST 2006


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

Modified Files:
	sb_filter.py 
Log Message:
Add [ 1081787 ] Adding the version only to sb_filter.py

Fix [ 1387699 ] train_on_filter=True needs the db to be opened read/write

Index: sb_filter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_filter.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** sb_filter.py	3 Jun 2005 01:13:17 -0000	1.18
--- sb_filter.py	7 Apr 2006 02:25:25 -0000	1.19
***************
*** 20,23 ****
--- 20,25 ----
      -h
          show usage and exit
+     -v
+         show version and exit
      -x
          show some usage examples and exit
***************
*** 136,139 ****
--- 138,146 ----
      sys.exit(code)
  
+ def version():
+     v = get_current_version()
+     print >> sys.stderr, v.get_long_version("SpamBayes Command Line Filter")
+     sys.exit(0)
+ 
  class HammieFilter(object):
      def __init__(self):
***************
*** 174,178 ****
  
      def filter(self, msg):
!         self.open('r')
          return self.h.filter(msg)
  
--- 181,188 ----
  
      def filter(self, msg):
!         if Options.options["Hammie", "train_on_filter"]:
!             self.open('c')
!         else:
!             self.open('r')
          return self.h.filter(msg)
  
***************
*** 204,213 ****
      h = HammieFilter()
      actions = []
!     opts, args = getopt.getopt(sys.argv[1:], 'hxd:p:nfgstGSo:',
!                                ['help', 'examples', 'option='])
      create_newdb = False
      for opt, arg in opts:
          if opt in ('-h', '--help'):
              usage(0)
          elif opt in ('-x', '--examples'):
              examples()
--- 214,225 ----
      h = HammieFilter()
      actions = []
!     opts, args = getopt.getopt(sys.argv[1:], 'hvxd:p:nfgstGSo:',
!                                ['help', 'version', 'examples', 'option='])
      create_newdb = False
      for opt, arg in opts:
          if opt in ('-h', '--help'):
              usage(0)
+         elif opt in ('-v', '--version'):
+             version()
          elif opt in ('-x', '--examples'):
              examples()



More information about the Spambayes-checkins mailing list