From 095e0e529f1ba429b8a8157e243ad00ec4c0b2a5 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Sat, 25 Jun 2016 22:08:03 +0100 Subject: [PATCH] 9547: Rename non-API database upgrade methods --- gramps/gen/db/base.py | 12 ------------ .../plugins/database/bsddb_support/test/db_test.py | 2 -- gramps/plugins/database/bsddb_support/write.py | 8 ++++---- gramps/plugins/database/dummydb.py | 8 -------- 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/gramps/gen/db/base.py b/gramps/gen/db/base.py index 2c69d5912..e321cb46b 100644 --- a/gramps/gen/db/base.py +++ b/gramps/gen/db/base.py @@ -879,12 +879,6 @@ class DbReadBase: """ raise NotImplementedError - def gramps_upgrade(self): - """ - Return True if database is upgraded - """ - raise NotImplementedError - def has_event_handle(self, handle): """ Return True if the handle exists in the current Event database. @@ -1582,12 +1576,6 @@ class DbWriteBase(DbReadBase): """ raise NotImplementedError - def need_schema_upgrade(self): - """ - Return True if database needs to be upgraded - """ - raise NotImplementedError - def rebuild_secondary(self, callback): """ Rebuild secondary indices diff --git a/gramps/plugins/database/bsddb_support/test/db_test.py b/gramps/plugins/database/bsddb_support/test/db_test.py index ddd3262a7..2c104b908 100644 --- a/gramps/plugins/database/bsddb_support/test/db_test.py +++ b/gramps/plugins/database/bsddb_support/test/db_test.py @@ -122,7 +122,6 @@ class DbTest(unittest.TestCase): "get_tag_handles", "get_surname_list", "get_url_types", - "gramps_upgrade", "has_event_handle", "has_family_handle", "has_gramps_id", @@ -194,7 +193,6 @@ class DbTest(unittest.TestCase): "commit_repository", "commit_source", "commit_tag", - "need_schema_upgrade", "rebuild_secondary", "reindex_reference_map", "remove_event", diff --git a/gramps/plugins/database/bsddb_support/write.py b/gramps/plugins/database/bsddb_support/write.py index 3fd84b959..8520f68aa 100644 --- a/gramps/plugins/database/bsddb_support/write.py +++ b/gramps/plugins/database/bsddb_support/write.py @@ -684,7 +684,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): return ((dbversion <= _DBVERSION) and (dbversion >= _MINVERSION)) @catch_db_error - def need_schema_upgrade(self): + def _need_schema_upgrade(self): dbversion = self.metadata.get(b'version', default=0) return not self.readonly and dbversion < _DBVERSION @@ -901,13 +901,13 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): self.__load_metadata() - if self.need_schema_upgrade(): + if self._need_schema_upgrade(): oldschema = self.metadata.get(b'version', default=0) newschema = _DBVERSION _LOG.debug("Schema upgrade required from %s to %s" % (oldschema, newschema)) if force_schema_upgrade == True: - self.gramps_upgrade(callback) + self._gramps_upgrade(callback) versionpath = os.path.join(name, str(SCHVERSFN)) with open(versionpath, "w") as version_file: version = str(_DBVERSION) @@ -2335,7 +2335,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): def redo(self, update_history=True): return self.undodb.redo(update_history) - def gramps_upgrade(self, callback=None): + def _gramps_upgrade(self, callback=None): UpdateCallback.__init__(self, callback) version = self.metadata.get(b'version', default=_MINVERSION) diff --git a/gramps/plugins/database/dummydb.py b/gramps/plugins/database/dummydb.py index fd656b3cb..a5ab64e07 100644 --- a/gramps/plugins/database/dummydb.py +++ b/gramps/plugins/database/dummydb.py @@ -1236,14 +1236,6 @@ class DummyDb(M_A_M_B("NewBaseClass", (DbReadBase, Callback, object,), {})): LOG.warn("database is closed") return [] - def gramps_upgrade(self): - """ - Return True if database is upgraded - """ - if not self.db_is_open: - LOG.warn("database is closed") - return True - def has_event_handle(self, handle): """ Return True if the handle exists in the current Event database.