Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3918/spambayes
Modified Files:
Options.py
Log Message:
Only default to ZODB if ZODB is importable.
Index: Options.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Options.py,v
retrieving revision 1.130
retrieving revision 1.131
diff -C2 -d -r1.130 -r1.131
*** Options.py 27 Nov 2005 02:15:33 -0000 1.130
--- Options.py 27 Nov 2005 22:05:45 -0000 1.131
***************
*** 36,39 ****
--- 36,58 ----
from OptionsClass import *
+ # A little magic. We'd like to use ZODB as the default storage,
+ # because we've had so many problems with bsddb, and we'd like to swap
+ # to new ZODB problems <wink>. However, apart from this, we only need
+ # a standard Python install - if the default was ZODB then we would
+ # need ZODB to be installed as well (which it will br for binary users,
+ # but might not be for source users). So what we do is check whether
+ # ZODB is importable and if it is, default to that, and if not, default
+ # to dbm. If ZODB is sometimes importable and sometimes not (e.g. you
+ # muck around with the PYTHONPATH), then this may not work well - the
+ # best idea would be to explicitly put the type in your configuration
+ # file.
+ try:
+ import ZODB
+ except ImportError:
+ DB_TYPE = "dbm", "hammie.db", "spambayes.messageinfo.db"
+ else:
+ del ZODB
+ DB_TYPE = "zodb", "hammie.fs", "messageinfo.fs"
+
# Format:
# defaults is a dictionary, where the keys are the section names
***************
*** 516,520 ****
# loaded by the appropriate application only.
"Storage" : (
! ("persistent_use_database", _("Database backend"), "zodb",
_("""SpamBayes can use either a ZODB or dbm database (quick to score
one message) or a pickle (quick to train on huge amounts of messages).
--- 535,539 ----
# loaded by the appropriate application only.
"Storage" : (
! ("persistent_use_database", _("Database backend"), DB_TYPE[0],
_("""SpamBayes can use either a ZODB or dbm database (quick to score
one message) or a pickle (quick to train on huge amounts of messages).
***************
*** 523,527 ****
("zeo", "zodb", "cdb", "mysql", "pgsql", "dbm", "pickle"), RESTORE),
! ("persistent_storage_file", _("Storage file name"), "hammie.fs",
_("""Spambayes builds a database of information that it gathers
from incoming emails and from you, the user, to get better and
--- 542,546 ----
("zeo", "zodb", "cdb", "mysql", "pgsql", "dbm", "pickle"), RESTORE),
! ("persistent_storage_file", _("Storage file name"), DB_TYPE[1],
_("""Spambayes builds a database of information that it gathers
from incoming emails and from you, the user, to get better and
***************
*** 532,536 ****
FILE_WITH_PATH, DO_NOT_RESTORE),
! ("messageinfo_storage_file", _("Message information file name"),
"messageinfo.fs",
_("""Spambayes builds a database of information about messages
that it has already seen and trained or classified. This
--- 551,555 ----
FILE_WITH_PATH, DO_NOT_RESTORE),
! ("messageinfo_storage_file", _("Message information file name"),
DB_TYPE[2],
_("""Spambayes builds a database of information about messages
that it has already seen and trained or classified. This
***************
*** 1197,1201 ****
}
-
# `optionsPathname` is the pathname of the last ini file in the list.
# This is where the web-based configuration page will write its changes.
--- 1216,1219 ----
_______________________________________________
Spambayes-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/spambayes-checkins