Possible Fix for database crash after adding new format and accessing calibre database afterwards

This commit is contained in:
OzzieIsaacs
2020-09-05 10:24:32 +02:00
parent f825c5ae83
commit feacbe8ebd
2 changed files with 7 additions and 8 deletions
+3 -1
View File
@@ -48,6 +48,7 @@ try:
except ImportError:
use_unidecode = False
Session = None
cc_exceptions = ['datetime', 'comments', 'composite', 'series']
cc_classes = {}
@@ -409,6 +410,7 @@ class CalibreDB():
def setup_db(self, config, app_db_path):
self.config = config
self.dispose()
global Session
if not config.config_calibre_dir:
config.invalidate()
@@ -506,7 +508,7 @@ class CalibreDB():
backref='books'))
Session = scoped_session(sessionmaker(autocommit=False,
autoflush=False,
autoflush=True,
bind=self.engine))
self.session = Session()
return True