mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 12:30:00 +00:00
Fix resetting the session when first configuring the calibre-db on first boot up
This commit is contained in:
parent
18d16f9a8b
commit
032cb59388
14
cps/db.py
14
cps/db.py
@ -423,10 +423,15 @@ class CalibreDB():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
""" Initialize a new CalibreDB session
|
""" Initialize a new CalibreDB session
|
||||||
"""
|
"""
|
||||||
if not self._init:
|
self.session = None
|
||||||
raise Exception("CalibreDB not initialized")
|
if self._init:
|
||||||
self.session = self.session_factory()
|
self.initSession()
|
||||||
|
|
||||||
self.instances.add(self)
|
self.instances.add(self)
|
||||||
|
|
||||||
|
|
||||||
|
def initSession(self):
|
||||||
|
self.session = self.session_factory()
|
||||||
self.update_title_sort(self.config)
|
self.update_title_sort(self.config)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -534,6 +539,9 @@ class CalibreDB():
|
|||||||
cls.session_factory = scoped_session(sessionmaker(autocommit=False,
|
cls.session_factory = scoped_session(sessionmaker(autocommit=False,
|
||||||
autoflush=True,
|
autoflush=True,
|
||||||
bind=cls.engine))
|
bind=cls.engine))
|
||||||
|
for inst in cls.instances:
|
||||||
|
inst.initSession()
|
||||||
|
|
||||||
cls._init = True
|
cls._init = True
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user