Remove hardcoded references to BSDDB database backend

The default backend in the preferences is now used for:

* Archive checkout
* Import from the command line - python Gramps.py file
* Import by drag and drop onto the family tree manager
This commit is contained in:
Nick Hall 2017-10-13 22:13:51 +01:00
parent 94a6495a06
commit 50091d1f86
2 changed files with 13 additions and 19 deletions

View File

@ -303,10 +303,10 @@ class CLIDbManager:
name_file.write(title)
if create_db:
# write the version number into metadata
if dbid is None:
dbid = "bsddb"
dbid = config.get('database.backend')
newdb = make_database(dbid)
# write the version number into metadata
newdb.write_version(new_path)
(tval, last) = time_val(new_path)
@ -355,15 +355,6 @@ class CLIDbManager:
# write locally:
temp_fp.write(data)
url_fp.close()
from gramps.gen.db.dbconst import BDBVERSFN
# name not set
(name, ext) = os.path.splitext(os.path.basename(filename))
versionpath = os.path.join(name, BDBVERSFN)
# dbase not set
dbase = make_database("bsddb")
_LOG.debug("Write bsddb version %s", str(dbase.version()))
with open(versionpath, "w") as version_file:
version_file.write(str(dbase.version()))
temp_fp.close()
(name, ext) = os.path.splitext(os.path.basename(filename))
@ -372,13 +363,13 @@ class CLIDbManager:
for plugin in pmgr.get_import_plugins():
if format == plugin.get_extension():
new_path, name = self._create_new_db(name, edit_entry=False)
dbid = config.get('database.backend')
new_path, name = self._create_new_db(name, dbid=dbid,
edit_entry=False)
# Create a new database
self.__start_cursor(_("Importing data..."))
## Use bsddb, for now, because we assumed that above.
dbid = "bsddb" ## config.get('database.backend')
dbase = make_database(dbid)
dbase.load(new_path, user.callback)

View File

@ -661,11 +661,13 @@ class DbManager(CLIDbManager, ManagedWindow):
Create a new database, then extracts a revision from RCS and
imports it into the db
"""
new_path, newname = self._create_new_db("%s : %s" % (parent_name, name))
dbid = config.get('database.backend')
new_path, newname = self._create_new_db("%s : %s" % (parent_name, name),
dbid=dbid)
self.__start_cursor(_("Extracting archive..."))
dbase = make_database("bsddb")
dbase = make_database(dbid)
dbase.load(new_path)
self.__start_cursor(_("Importing archive..."))
@ -811,10 +813,11 @@ class DbManager(CLIDbManager, ManagedWindow):
while self.existing_name(new_text):
count += 1
new_text = "%s %s" % (name, _("(Converted #%d)") % count)
new_path, newname = self._create_new_db(new_text, edit_entry=False)
dbid = config.get('database.backend')
new_path, newname = self._create_new_db(new_text, dbid=dbid,
edit_entry=False)
## Create a new database of correct type:
dbase = make_database(config.get('database.backend'))
dbase.write_version(new_path)
dbase = make_database(dbid)
dbase.load(new_path)
## import from XML
import_function = None