1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-10-28 22:07:41 +00:00

No autoflush on metadata.db change

This commit is contained in:
Ozzie Isaacs
2021-01-10 11:01:54 +01:00
parent 4a9b01e93b
commit 6f9e52792a
3 changed files with 14 additions and 6 deletions

View File

@@ -402,7 +402,10 @@ class AlchemyEncoder(json.JSONEncoder):
el.append(ele.get())
else:
el.append(json.dumps(ele, cls=AlchemyEncoder))
data = ",".join(el)
if field == 'authors':
data = " & ".join(el)
else:
data = ",".join(el)
if data == '[]':
data = ""
else:
@@ -542,7 +545,7 @@ class CalibreDB():
backref='books'))
cls.session_factory = scoped_session(sessionmaker(autocommit=False,
autoflush=True,
autoflush=False,
bind=cls.engine))
for inst in cls.instances:
inst.initSession()
@@ -619,9 +622,12 @@ class CalibreDB():
.join(*join, isouter=True) \
.filter(db_filter) \
.filter(self.common_filters(allow_show_archived))
pagination = Pagination(page, pagesize,
len(query.all()))
entries = query.order_by(*order).offset(off).limit(pagesize).all()
try:
pagination = Pagination(page, pagesize,
len(query.all()))
entries = query.order_by(*order).offset(off).limit(pagesize).all()
except Exception as e:
logger.debug(e)
for book in entries:
book = self.order_authors(book)
return entries, randm, pagination