Remove is_empty database method

The existing get_total method can be used instead.
This commit is contained in:
Nick Hall 2016-12-06 17:48:29 +00:00
parent 3e69fa5cbe
commit 61da801fa1
3 changed files with 2 additions and 11 deletions

View File

@ -316,7 +316,7 @@ class CLIManager:
# database is empty, then copy default researcher to DB owner
if (res.is_empty()
and not owner.is_empty()
and self.dbstate.db.is_empty()):
and self.dbstate.db.get_total() == 0):
self.dbstate.db.set_researcher(owner)
name_displayer.set_name_format(self.dbstate.db.name_formats)

View File

@ -721,15 +721,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
def is_open(self):
return self.db_is_open
def is_empty(self):
"""
Return true if there are no [primary] records in the database
"""
for table in self.get_table_func():
if len(self.get_table_func(table, "handles_func")()) > 0:
return False
return True
def get_dbid(self):
"""
We use the file directory name as the unique ID for

View File

@ -1757,7 +1757,7 @@ class GedcomParser(UpdateCallback):
self.number_of_errors = 0
self.maxpeople = stage_one.get_person_count()
self.dbase = dbase
self.import_researcher = self.dbase.is_empty()
self.import_researcher = self.dbase.get_total() == 0
self.emapper = IdFinder(dbase.get_gramps_ids(EVENT_KEY),
dbase.event_prefix)
self.famc_map = stage_one.get_famc_map()