[Spambayes-checkins] spambayes/spambayes dbmstorage.py,1.8,1.8.2.1
Tony Meyer
anadelonbrin at users.sourceforge.net
Wed Oct 29 19:08:49 EST 2003
Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv32663/spambayes
Modified Files:
Tag: release_1_0
dbmstorage.py
Log Message:
Copy Skip's fix for the wrong type of dbm problem over to the 1.0 branch.
Index: dbmstorage.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/dbmstorage.py,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -d -r1.8 -r1.8.2.1
*** dbmstorage.py 5 Sep 2003 01:15:28 -0000 1.8
--- dbmstorage.py 30 Oct 2003 00:08:46 -0000 1.8.2.1
***************
*** 3,6 ****
--- 3,8 ----
from spambayes.Options import options
import sys
+ import whichdb
+ import os
class error(Exception):
***************
*** 46,53 ****
}
! def open(*args):
! dbm_type = options["globals", "dbm_type"].lower()
f = open_funcs.get(dbm_type)
! if not f:
! raise error("Unknown dbm type in options file")
! return f(*args)
--- 48,60 ----
}
! def open(db_name, mode):
! if os.path.exists(db_name):
! # let the file tell us what db to use
! dbm_type = whichdb.whichdb(db_name)
! else:
! # fresh file - open with what the user specified
! dbm_type = options["globals", "dbm_type"].lower()
f = open_funcs.get(dbm_type)
! if f is None:
! raise error("Unknown dbm type: %s" % dbm_type)
! return f(db_name, mode)
More information about the Spambayes-checkins
mailing list