9538: gramps.gen.dbstate.DbState.make_database doesn't handle 'else' branch

This commit is contained in:
Doug Blank 2016-09-23 17:07:12 -04:00
parent 9e5f899bbd
commit 3b0e04fb78

View File

@ -203,16 +203,21 @@ class DbState(Callback):
else: else:
self.save_modules() self.save_modules()
mod = pmgr.load_plugin(pdata) mod = pmgr.load_plugin(pdata)
database = getattr(mod, pdata.databaseclass) if mod:
db = database() database = getattr(mod, pdata.databaseclass)
import inspect db = database()
caller_frame = inspect.stack()[1] import inspect
_LOG.debug("Database class instance created Class:%s instance:%s. " caller_frame = inspect.stack()[1]
"Called from File %s, line %s, in %s" _LOG.debug("Database class instance created Class:%s instance:%s. "
% ((db.__class__.__name__, hex(id(db))) "Called from File %s, line %s, in %s"
+ (os.path.split(caller_frame[1])[1],) % ((db.__class__.__name__, hex(id(db)))
+ tuple(caller_frame[i] for i in range(2, 4)))) + (os.path.split(caller_frame[1])[1],)
return db + tuple(caller_frame[i] for i in range(2, 4))))
return db
else:
raise Exception("can't load database backend: '%s'" % plugin_id)
else:
raise Exception("no such database backend: '%s'" % plugin_id)
def open_database(self, dbname, force_unlock=False, callback=None): def open_database(self, dbname, force_unlock=False, callback=None):
""" """