clidbman: restore accidently deleted code

This commit is contained in:
Doug Blank 2016-04-16 17:38:01 -04:00
parent 7accf755d5
commit 1e228b2193

View File

@ -159,9 +159,9 @@ class CLIDbManager(object):
if not self.is_locked(dirpath):
try:
database = self.dbstate.make_database(dbid)
database.load(dirpath, None)
database.load(dirpath, None, update=False)
retval = database.get_summary()
database.close()
database.close(update=False)
except Exception as msg:
retval = {_("Unavailable"): str(msg)[:74] + "..."}
else:
@ -174,7 +174,7 @@ class CLIDbManager(object):
})
return retval
def print_family_tree_summaries(self):
def print_family_tree_summaries(self, database_names=None):
"""
Prints a detailed list of the known family trees.
"""
@ -182,6 +182,8 @@ class CLIDbManager(object):
for item in self.current_names:
(name, dirpath, path_name, last,
tval, enable, stock_id, backend_type, version) = item
if (database_names is None or
any([re.match(dbname, name) for dbname in database_names])):
summary = self.get_dbdir_summary(dirpath, name)
print(_("Family Tree \"%s\":") % summary[_("Family Tree")])
for item in sorted(summary):
@ -191,7 +193,7 @@ class CLIDbManager(object):
'item' : item,
'summary' : summary[item] } )
def family_tree_summary(self):
def family_tree_summary(self, database_names=None):
"""
Return a list of dictionaries of the known family trees.
"""
@ -199,7 +201,9 @@ class CLIDbManager(object):
summary_list = []
for item in self.current_names:
(name, dirpath, path_name, last,
tval, enable, stock_id, backend_type) = item
tval, enable, stock_id, backend_type, version) = item
if (database_names is None or
any([re.match(dbname, name) for dbname in database_names])):
retval = self.get_dbdir_summary(dirpath, name)
summary_list.append( retval )
return summary_list
@ -300,7 +304,7 @@ class CLIDbManager(object):
(tval, last) = time_val(new_path)
self.current_names.append((title, new_path, path_name,
last, tval, False, "", "Backend Type"))
last, tval, False, "", dbid))
return new_path, title
def _create_new_db(self, title=None, dbid=None):
@ -412,10 +416,10 @@ class CLIDbManager(object):
"No matching family tree found: '%s'" % dbname)
# now delete them:
for (name, directory) in match_list:
if user is None or user.prompt(
if user is None or not user.prompt(
_('Remove family tree warning'),
_('Are you sure you want to remove the family tree named\n"%s"?' % name),
_('Yes'), _('No'), None):
_('no'), _('yes')):
try:
for (top, dirs, files) in os.walk(directory):
for filename in files: