[Spambayes-checkins] spambayes/spambayes Options.py, 1.126, 1.127 storage.py, 1.53, 1.54

Tony Meyer anadelonbrin at users.sourceforge.net
Sat Nov 26 06:33:11 CET 2005


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

Modified Files:
	Options.py storage.py 
Log Message:
Remove 1.0 backwards compatibility options of using True for dbm and False for pickle.

Add read-only mode to ZODBClassifier.

Index: Options.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Options.py,v
retrieving revision 1.126
retrieving revision 1.127
diff -C2 -d -r1.126 -r1.127
*** Options.py	15 Nov 2005 00:30:34 -0000	1.126
--- Options.py	26 Nov 2005 05:33:03 -0000	1.127
***************
*** 525,530 ****
       (i.e. changing "True" to "dbm" and "False" to "pickle", or sticking
       with the default."""),
!      # True == "dbm", False == "pickle", "True" == "dbm", "False" == "pickle"
!      ("zeo", "zodb", "cdb", "mysql", "pgsql", "dbm", "pickle", "True", "False", True, False), RESTORE),
  
      ("persistent_storage_file", _("Storage file name"), "hammie.db",
--- 525,529 ----
       (i.e. changing "True" to "dbm" and "False" to "pickle", or sticking
       with the default."""),
!      ("zeo", "zodb", "cdb", "mysql", "pgsql", "dbm", "pickle"), RESTORE),
  
      ("persistent_storage_file", _("Storage file name"), "hammie.db",

Index: storage.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/storage.py,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** storage.py	26 Nov 2005 05:07:32 -0000	1.53
--- storage.py	26 Nov 2005 05:33:03 -0000	1.54
***************
*** 688,695 ****
      ClassifierClass = _PersistentClassifier
  
!     def __init__(self, db_name):
          self.db_filename = db_name
          self.db_name = os.path.basename(db_name)
          self.closed = True
          self.load()
  
--- 688,696 ----
      ClassifierClass = _PersistentClassifier
  
!     def __init__(self, db_name, mode='c'):
          self.db_filename = db_name
          self.db_name = os.path.basename(db_name)
          self.closed = True
+         self.mode = mode
          self.load()
  
***************
*** 711,715 ****
          import ZODB
          from ZODB.FileStorage import FileStorage
!         self.storage = FileStorage(self.db_filename)
  
      def load(self):
--- 712,717 ----
          import ZODB
          from ZODB.FileStorage import FileStorage
!         self.storage = FileStorage(self.db_filename,
!                                    read_only=self.mode=='r')
  
      def load(self):
***************
*** 926,930 ****
                    "mysql" : (mySQLClassifier, False, False),
                    "cdb" : (CDBClassifier, False, True),
!                   "zodb" : (ZODBClassifier, False, True),
                    "zeo" : (ZEOClassifier, False, False),
                    }
--- 928,932 ----
                    "mysql" : (mySQLClassifier, False, False),
                    "cdb" : (CDBClassifier, False, True),
!                   "zodb" : (ZODBClassifier, True, True),
                    "zeo" : (ZEOClassifier, False, False),
                    }
***************
*** 990,998 ****
      if nm is None and typ is None:
          typ = options[default_type]
-         # Backwards compatibility crud.
-         if typ is True or typ == "True":
-             typ = "dbm"
-         elif typ is False or typ == "False":
-             typ = "pickle"
          try:
              unused, unused, is_path = _storage_types[typ]
--- 992,995 ----



More information about the Spambayes-checkins mailing list