diff --git a/gramps/cli/clidbman.py b/gramps/cli/clidbman.py index 8c8352745..7e2fbc79a 100644 --- a/gramps/cli/clidbman.py +++ b/gramps/cli/clidbman.py @@ -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) diff --git a/gramps/gui/dbman.py b/gramps/gui/dbman.py index 879362f3a..afa8df8b2 100644 --- a/gramps/gui/dbman.py +++ b/gramps/gui/dbman.py @@ -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