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,15 +155,18 @@ 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()
lock_path = os.path.join(dirpath, "lock")
if not os.path.isfile(lock_path):
try: try:
database = self.dbstate.make_database(dbid) database = self.dbstate.make_database(dbid)
database.load(dirpath, None) database.load(dirpath, None)
retval = database.get_summary() retval = database.get_summary()
database.close() database.close()
except Exception as msg: except Exception as msg:
retval = {"Unavailable": str(msg)[:74] + "..."} retval = {_("Unavailable"): str(msg)[:74] + "..."}
retval.update({ else:
_("Family Tree"): name, retval = {_("Locked?"): "True"}
retval.update({_("Family Tree"): name,
_("Path"): dirpath, _("Path"): dirpath,
_("Database backend"): dbid, _("Database backend"): dbid,
_("Last accessed"): time_val(dirpath)[1], _("Last accessed"): time_val(dirpath)[1],