From 72ca67e7c99e13cbdb504f5697656c3e40cd6209 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Sat, 25 Jun 2016 21:40:04 +0100 Subject: [PATCH] 9547: Rename another non-API database method --- gramps/gen/db/base.py | 6 ----- gramps/plugins/database/bsddb_support/read.py | 22 +++++++++---------- .../database/bsddb_support/test/db_test.py | 1 - gramps/plugins/database/dummydb.py | 9 -------- 4 files changed, 11 insertions(+), 27 deletions(-) diff --git a/gramps/gen/db/base.py b/gramps/gen/db/base.py index 6327743d1..cca152769 100644 --- a/gramps/gen/db/base.py +++ b/gramps/gen/db/base.py @@ -358,12 +358,6 @@ class DbReadBase: """ raise NotImplementedError - def get_from_handle(self, handle, class_type, data_map): - """ - Return unserialized data from database given handle and object class - """ - raise NotImplementedError - def get_gramps_ids(self, obj_key): """ Returns all the keys from a table given a table name diff --git a/gramps/plugins/database/bsddb_support/read.py b/gramps/plugins/database/bsddb_support/read.py index 05bf05ddb..63735922c 100644 --- a/gramps/plugins/database/bsddb_support/read.py +++ b/gramps/plugins/database/bsddb_support/read.py @@ -723,7 +723,7 @@ class DbBsddbRead(DbReadBase, Callback): self.nmap_index, self.nid_trans) return gid - def get_from_handle(self, handle, class_type, data_map): + def _get_from_handle(self, handle, class_type, data_map): if isinstance(handle, str): handle = handle.encode('utf-8') data = data_map.get(handle) @@ -768,7 +768,7 @@ class DbBsddbRead(DbReadBase, Callback): If no such Person exists, a HandleError is raised. """ - return self.get_from_handle(handle, Person, self.person_map) + return self._get_from_handle(handle, Person, self.person_map) def get_source_from_handle(self, handle): """ @@ -776,7 +776,7 @@ class DbBsddbRead(DbReadBase, Callback): If no such Source exists, a HandleError is raised. """ - return self.get_from_handle(handle, Source, self.source_map) + return self._get_from_handle(handle, Source, self.source_map) def get_citation_from_handle(self, handle): """ @@ -784,7 +784,7 @@ class DbBsddbRead(DbReadBase, Callback): If no such Citation exists, a HandleError is raised. """ - return self.get_from_handle(handle, Citation, self.citation_map) + return self._get_from_handle(handle, Citation, self.citation_map) def get_media_from_handle(self, handle): """ @@ -792,7 +792,7 @@ class DbBsddbRead(DbReadBase, Callback): If no such Object exists, a HandleError is raised. """ - return self.get_from_handle(handle, Media, self.media_map) + return self._get_from_handle(handle, Media, self.media_map) def get_place_from_handle(self, handle): """ @@ -800,7 +800,7 @@ class DbBsddbRead(DbReadBase, Callback): If no such Place exists, a HandleError is raised. """ - return self.get_from_handle(handle, Place, self.place_map) + return self._get_from_handle(handle, Place, self.place_map) def get_event_from_handle(self, handle): """ @@ -808,7 +808,7 @@ class DbBsddbRead(DbReadBase, Callback): If no such Event exists, a HandleError is raised. """ - return self.get_from_handle(handle, Event, self.event_map) + return self._get_from_handle(handle, Event, self.event_map) def get_family_from_handle(self, handle): """ @@ -816,7 +816,7 @@ class DbBsddbRead(DbReadBase, Callback): If no such Family exists, a HandleError is raised. """ - return self.get_from_handle(handle, Family, self.family_map) + return self._get_from_handle(handle, Family, self.family_map) def get_repository_from_handle(self, handle): """ @@ -824,7 +824,7 @@ class DbBsddbRead(DbReadBase, Callback): If no such Repository exists, a HandleError is raised. """ - return self.get_from_handle(handle, Repository, self.repository_map) + return self._get_from_handle(handle, Repository, self.repository_map) def get_note_from_handle(self, handle): """ @@ -832,7 +832,7 @@ class DbBsddbRead(DbReadBase, Callback): If no such Note exists, a HandleError is raised. """ - return self.get_from_handle(handle, Note, self.note_map) + return self._get_from_handle(handle, Note, self.note_map) def get_tag_from_handle(self, handle): """ @@ -840,7 +840,7 @@ class DbBsddbRead(DbReadBase, Callback): If no such Tag exists, a HandleError is raised. """ - return self.get_from_handle(handle, Tag, self.tag_map) + return self._get_from_handle(handle, Tag, self.tag_map) def __get_obj_from_gramps_id(self, val, tbl, class_, prim_tbl): if isinstance(tbl, dict): diff --git a/gramps/plugins/database/bsddb_support/test/db_test.py b/gramps/plugins/database/bsddb_support/test/db_test.py index 08b82014f..33a49a1fd 100644 --- a/gramps/plugins/database/bsddb_support/test/db_test.py +++ b/gramps/plugins/database/bsddb_support/test/db_test.py @@ -57,7 +57,6 @@ class DbTest(unittest.TestCase): "get_family_from_handle", "get_family_handles", "get_family_relation_types", - "get_from_handle", "get_gramps_ids", "get_media_attribute_types", "get_media_bookmarks", diff --git a/gramps/plugins/database/dummydb.py b/gramps/plugins/database/dummydb.py index 156ba603b..393a987f3 100644 --- a/gramps/plugins/database/dummydb.py +++ b/gramps/plugins/database/dummydb.py @@ -549,15 +549,6 @@ class DummyDb(M_A_M_B("NewBaseClass", (DbReadBase, Callback, object,), {})): LOG.warn("database is closed") return [] - def get_from_handle(self, handle, class_type, data_map): - """ - Return unserialized data from database given handle and object class - """ - if not self.db_is_open: - LOG.warn("database is closed") - LOG.warn("handle %s does not exist in the dummy database" % handle) - raise HandleError('Handle %s not found' % handle.decode('utf-8')) - def get_gramps_ids(self, obj_key): """ Returns all the keys from a table given a table name