Remove get_from_name_and_gramps_id method

Issue #9541.
This commit is contained in:
Nick Hall 2017-09-29 19:42:39 +01:00
parent 5cb9c3e30e
commit 755254cf7c
3 changed files with 2 additions and 31 deletions

View File

@ -800,21 +800,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
return self._get_table_func(table_name) return self._get_table_func(table_name)
return None 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
Gramps ID.
Examples:
>>> self.get_from_name_and_gramps_id("Person", "I00002")
>>> self.get_from_name_and_gramps_id("Family", "F056")
>>> self.get_from_name_and_gramps_id("Media", "M00012")
"""
if table_name in self._get_table_func():
return self._get_table_func(table_name, "gramps_id_func")(gramps_id)
return None
def _txn_begin(self): def _txn_begin(self):
""" """
Lowlevel interface to the backend transaction. Lowlevel interface to the backend transaction.

View File

@ -269,7 +269,8 @@ class EditReference(ManagedWindow, DbGUIElement):
""" """
new_id = self.source.get_gramps_id() new_id = self.source.get_gramps_id()
if new_id: if new_id:
old_primary = self.db.get_from_name_and_gramps_id(type, new_id) id_func = getattr(self.db, 'get_%s_from_gramps_id' % type.lower())
old_primary = id_func(new_id)
if old_primary: if old_primary:
description = None description = None
if type == 'Event': if type == 'Event':

View File

@ -488,21 +488,6 @@ class DbBsddbRead(DbReadBase, Callback):
return self._get_table_func(table_name) return self._get_table_func(table_name)
return None 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
Gramps ID.
Examples:
>>> self.get_from_name_and_gramps_id("Person", "I00002")
>>> self.get_from_name_and_gramps_id("Family", "F056")
>>> self.get_from_name_and_gramps_id("Media", "M00012")
"""
if table_name in self._get_table_func():
return self._get_table_func(table_name,"gramps_id_func")(gramps_id)
return None
def set_prefixes(self, person, media, family, source, citation, place, def set_prefixes(self, person, media, family, source, citation, place,
event, repository, note): event, repository, note):
self.set_person_id_prefix(person) self.set_person_id_prefix(person)