8727: Gramps -L leaves all BSDDB type trees locked

Don't even open if locked.
This commit is contained in:
Doug Blank 2015-07-18 14:34:02 -04:00
parent 2fe71bfe4e
commit cf5d847c32

View File

@ -155,20 +155,23 @@ class CLIDbManager(object):
dbid_path = os.path.join(dirpath, "database.txt") dbid_path = os.path.join(dirpath, "database.txt")
if os.path.isfile(dbid_path): if os.path.isfile(dbid_path):
dbid = open(dbid_path).read().strip() dbid = open(dbid_path).read().strip()
try: lock_path = os.path.join(dirpath, "lock")
database = self.dbstate.make_database(dbid) if not os.path.isfile(lock_path):
database.load(dirpath, None) try:
retval = database.get_summary() database = self.dbstate.make_database(dbid)
database.close() database.load(dirpath, None)
except Exception as msg: retval = database.get_summary()
retval = {"Unavailable": str(msg)[:74] + "..."} database.close()
retval.update({ except Exception as msg:
_("Family Tree"): name, retval = {_("Unavailable"): str(msg)[:74] + "..."}
_("Path"): dirpath, else:
_("Database backend"): dbid, retval = {_("Locked?"): "True"}
_("Last accessed"): time_val(dirpath)[1], retval.update({_("Family Tree"): name,
_("Locked?"): self.is_locked(dirpath), _("Path"): dirpath,
}) _("Database backend"): dbid,
_("Last accessed"): time_val(dirpath)[1],
_("Locked?"): self.is_locked(dirpath),
})
return retval return retval
def family_tree_summary(self): def family_tree_summary(self):