Remove get_from_name_and_handle_method

Issue #9541.
This commit is contained in:
Nick Hall 2017-09-29 18:52:58 +01:00
parent 43c768c2d4
commit 5cb9c3e30e
3 changed files with 4 additions and 31 deletions

View File

@ -800,20 +800,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
return self._get_table_func(table_name)
return None
def get_from_name_and_handle(self, table_name, handle):
"""
Returns a gen.lib object (or None) given table_name and
handle.
Examples:
>>> self.get_from_name_and_handle("Person", "a7ad62365bc652387008")
>>> self.get_from_name_and_handle("Media", "c3434653675bcd736f23")
"""
if table_name in self._get_table_func() and handle:
return self._get_table_func(table_name, "handle_func")(handle)
return None
def get_from_name_and_gramps_id(self, table_name, gramps_id):
"""
Returns a gen.lib object (or None) given table_name and

View File

@ -133,11 +133,12 @@ class Gramplet:
def get_active_object(self, nav_type):
"""
Return the object of the active handle for the given navigation type.
Assumes nav_type is one of the codes of Db.get_by_name.
"""
handle = self.uistate.get_active(nav_type, self.nav_group)
if nav_type in self.dbstate.db.get_table_names() and handle:
return self.dbstate.db.get_from_name_and_handle(nav_type, handle)
handle_func = getattr(self.dbstate.db,
'get_%s_from_handle' % nav_type.lower())
if handle:
return handle_func(handle)
return None
def set_active(self, nav_type, handle):

View File

@ -503,20 +503,6 @@ class DbBsddbRead(DbReadBase, Callback):
return self._get_table_func(table_name,"gramps_id_func")(gramps_id)
return None
def get_from_name_and_handle(self, table_name, handle):
"""
Returns a gen.lib object (or None) given table_name and
handle.
Examples:
>>> self.get_from_name_and_handle("Person", "a7ad62365bc652387008")
>>> self.get_from_name_and_handle("Media", "c3434653675bcd736f23")
"""
if table_name in self._get_table_func() and handle:
return self._get_table_func(table_name,"handle_func")(handle)
return None
def set_prefixes(self, person, media, family, source, citation, place,
event, repository, note):
self.set_person_id_prefix(person)