[Spambayes-checkins] spambayes/scripts sb_filter.py, 1.8, 1.9 sb_imapfilter.py, 1.17, 1.18 sb_server.py, 1.17, 1.18 sb_xmlrpcserver.py, 1.3, 1.4

Tony Meyer anadelonbrin at users.sourceforge.net
Mon Jan 12 03:36:17 EST 2004


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

Modified Files:
	sb_filter.py sb_imapfilter.py sb_server.py sb_xmlrpcserver.py 
Log Message:
Well, it's been some time, and no-one disagreed, and three people liked the idea,
so here it is.

MAY BREAK THINGS!

>From now, path/file options are not relative to the current working directory,
they are relative to the last configuration file loaded.  This still defaults to the
current working directory (except on Windows with win32all, where it's still
the User Application Data directory).  So this should mean no noticeable change,
unless your last configuration file is not in the current working directory, and
your data is.

Index: sb_filter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_filter.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** sb_filter.py	26 Nov 2003 20:43:43 -0000	1.8
--- sb_filter.py	12 Jan 2004 08:36:15 -0000	1.9
***************
*** 146,151 ****
          options.merge_files(['/etc/hammierc',
                              os.path.expanduser('~/.hammierc')])
!         self.dbname = options["Storage", "persistent_storage_file"]
!         self.dbname = os.path.expanduser(self.dbname)
          self.usedb = options["Storage", "persistent_use_database"]
  
--- 146,151 ----
          options.merge_files(['/etc/hammierc',
                              os.path.expanduser('~/.hammierc')])
!         self.dbname = Options.get_pathname_option("Storage",
!                                                   "persistent_storage_file")
          self.usedb = options["Storage", "persistent_use_database"]
  

Index: sb_imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_imapfilter.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** sb_imapfilter.py	16 Dec 2003 05:06:33 -0000	1.17
--- sb_imapfilter.py	12 Jan 2004 08:36:15 -0000	1.18
***************
*** 101,105 ****
  from email.Utils import parsedate
  
! from spambayes.Options import options
  from spambayes import tokenizer, storage, message, Dibbler
  from spambayes.UserInterface import UserInterfaceServer
--- 101,105 ----
  from email.Utils import parsedate
  
! from spambayes.Options import options, get_pathname_option
  from spambayes import tokenizer, storage, message, Dibbler
  from spambayes.UserInterface import UserInterfaceServer
***************
*** 698,702 ****
          sys.exit()
  
!     bdbname = options["Storage", "persistent_storage_file"]
      useDBM = options["Storage", "persistent_use_database"]
      doTrain = False
--- 698,702 ----
          sys.exit()
  
!     bdbname = get_pathname_option("Storage", "persistent_storage_file")
      useDBM = options["Storage", "persistent_use_database"]
      doTrain = False

Index: sb_server.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_server.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** sb_server.py	4 Jan 2004 18:26:59 -0000	1.17
--- sb_server.py	12 Jan 2004 08:36:15 -0000	1.18
***************
*** 103,107 ****
  from spambayes.FileCorpus import FileCorpus, ExpiryFileCorpus
  from spambayes.FileCorpus import FileMessageFactory, GzipFileMessageFactory
! from spambayes.Options import options
  from spambayes.UserInterface import UserInterfaceServer
  from spambayes.ProxyUI import ProxyUserInterface
--- 103,107 ----
  from spambayes.FileCorpus import FileCorpus, ExpiryFileCorpus
  from spambayes.FileCorpus import FileMessageFactory, GzipFileMessageFactory
! from spambayes.Options import options, get_pathname_option
  from spambayes.UserInterface import UserInterfaceServer
  from spambayes.ProxyUI import ProxyUserInterface
***************
*** 725,729 ****
              options["Storage", "persistent_storage_file"] = \
                          '_pop3proxy_test.pickle'   # This is never saved.
!         filename = options["Storage", "persistent_storage_file"]
          filename = os.path.expanduser(filename)
          self.bayes = storage.open_storage(filename, self.useDB)
--- 725,729 ----
              options["Storage", "persistent_storage_file"] = \
                          '_pop3proxy_test.pickle'   # This is never saved.
!         filename = get_pathname_option("Storage", "persistent_storage_file")
          filename = os.path.expanduser(filename)
          self.bayes = storage.open_storage(filename, self.useDB)
***************
*** 743,749 ****
              # Create/open the Corpuses.  Use small cache sizes to avoid hogging
              # lots of memory.
!             map(ensureDir, [options["Storage", "spam_cache"],
!                             options["Storage", "ham_cache"],
!                             options["Storage", "unknown_cache"]])
              if self.gzipCache:
                  factory = GzipFileMessageFactory()
--- 743,750 ----
              # Create/open the Corpuses.  Use small cache sizes to avoid hogging
              # lots of memory.
!             sc = get_pathname_option("Storage", "spam_cache")
!             hc = get_pathname_option("Storage", "ham_cache")
!             uc = get_pathname_option("Storage", "unknown_cache")
!             map(ensureDir, [sc, hc, uc])
              if self.gzipCache:
                  factory = GzipFileMessageFactory()
***************
*** 751,768 ****
                  factory = FileMessageFactory()
              age = options["Storage", "cache_expiry_days"]*24*60*60
!             self.spamCorpus = ExpiryFileCorpus(age, factory,
!                                                options["Storage",
!                                                        "spam_cache"],
                                                 '[0123456789\-]*',
                                                 cacheSize=20)
!             self.hamCorpus = ExpiryFileCorpus(age, factory,
!                                               options["Storage",
!                                                       "ham_cache"],
                                                '[0123456789\-]*',
                                                cacheSize=20)
!             self.unknownCorpus = ExpiryFileCorpus(age, factory,
!                                             options["Storage",
!                                                     "unknown_cache"],
!                                             '[0123456789\-]*',
                                                    cacheSize=20)
  
--- 752,763 ----
                  factory = FileMessageFactory()
              age = options["Storage", "cache_expiry_days"]*24*60*60
!             self.spamCorpus = ExpiryFileCorpus(age, factory, sc,
                                                 '[0123456789\-]*',
                                                 cacheSize=20)
!             self.hamCorpus = ExpiryFileCorpus(age, factory, hc,
                                                '[0123456789\-]*',
                                                cacheSize=20)
!             self.unknownCorpus = ExpiryFileCorpus(age, factory, uc,
!                                                   '[0123456789\-]*',
                                                    cacheSize=20)
  

Index: sb_xmlrpcserver.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_xmlrpcserver.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** sb_xmlrpcserver.py	25 Nov 2003 03:58:14 -0000	1.3
--- sb_xmlrpcserver.py	12 Jan 2004 08:36:15 -0000	1.4
***************
*** 78,83 ****
      options = Options.options
  
!     dbname = options["Storage", "persistent_storage_file"]
!     dbname = os.path.expanduser(dbname)
      usedb = options["Storage", "persistent_use_database"]
      for opt, arg in opts:
--- 78,83 ----
      options = Options.options
  
!     dbname = Options.get_pathname_option("Storage",
!                                          "persistent_storage_file")
      usedb = options["Storage", "persistent_use_database"]
      for opt, arg in opts:





More information about the Spambayes-checkins mailing list