Remove set_save_path method

The path is already set in the database load method.
This commit is contained in:
Nick Hall 2017-09-30 21:35:41 +01:00
parent aed7560a46
commit b3b46c70b2
8 changed files with 3 additions and 29 deletions

View File

@ -174,7 +174,6 @@ class CLIDbLoader:
try:
self.dbstate.db.load(filename, self._pulse_progress, mode)
self.dbstate.db.set_save_path(filename)
except DbEnvironmentError as msg:
self.dbstate.no_database()
self._errordialog(_("Cannot open database"), str(msg))
@ -307,11 +306,6 @@ class CLIManager:
if title:
name = title
# This method is for UI stuff when the database has changed.
# Window title, recent files, etc related to new file.
self.dbstate.db.set_save_path(filename)
# apply preferred researcher if loaded file has none
res = self.dbstate.db.get_researcher()
owner = get_researcher()

View File

@ -1404,12 +1404,6 @@ class DbReadBase:
"""
raise NotImplementedError
def set_save_path(self, path):
"""
Set the save path for the database.
"""
raise NotImplementedError
def get_dbid(self):
"""
A unique ID for this database on this computer.

View File

@ -1630,13 +1630,6 @@ class DummyDb(M_A_M_B("NewBaseClass", (DbReadBase, Callback, object,), {})):
if not self.db_is_open:
LOG.warning("database is closed")
def set_save_path(self, path):
"""
Set the save path for the database.
"""
if not self.db_is_open:
LOG.warning("database is closed")
def get_dbid(self):
"""
A unique ID for this database on this computer.

View File

@ -528,7 +528,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
"del_func": self.remove_tag,
}
}
self.set_save_path(directory)
self.readonly = False
self.db_is_open = False
self.name_formats = []
@ -636,7 +635,8 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
# surname list
self.surname_list = self.get_surname_list()
self.set_save_path(directory)
self._set_save_path(directory)
if self._directory:
self.undolog = os.path.join(self._directory, DBUNDOFN)
else:
@ -2371,7 +2371,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
def get_save_path(self):
return self._directory
def set_save_path(self, directory):
def _set_save_path(self, directory):
self._directory = directory
if directory:
self.full_name = os.path.abspath(self._directory)

View File

@ -195,7 +195,6 @@ class DbLoader(CLIDbLoader):
force_bsddb_upgrade,
force_bsddb_downgrade,
force_python_upgrade)
db.set_save_path(filename)
if self.dbstate.is_open():
self.dbstate.db.close(
user=User(callback=self._pulse_progress,

View File

@ -933,7 +933,6 @@ class DbManager(CLIDbManager, ManagedWindow):
newdb.write_version(dirname)
dbase = make_database("bsddb")
dbase.set_save_path(dirname)
dbase.load(dirname, None)
self.__start_cursor(_("Rebuilding database from backup files"))

View File

@ -1411,10 +1411,6 @@ class DbBsddbRead(DbReadBase, Callback):
"""Return the save path of the file, or "" if one does not exist."""
return self.path
def set_save_path(self, path):
"""Set the save path for the database."""
self.path = path
def get_event_attribute_types(self):
"""
Return a list of all Attribute types assocated with Event instances

View File

@ -168,7 +168,6 @@ class DbTest(unittest.TestCase):
# Other set methods:
"set_mediapath",
"set_researcher",
"set_save_path",
"version_supported",
]