1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-24 18:47:23 +00:00

Always catch sqlite create_function error

This commit is contained in:
Ozzie Isaacs 2022-04-24 13:15:41 +02:00
parent bc96ff9a39
commit 8421a17a82
2 changed files with 8 additions and 7 deletions

View File

@ -25,6 +25,7 @@ from datetime import datetime
from urllib.parse import quote
import unidecode
from sqlite3 import OperationalError as sqliteOperationalError
from sqlalchemy import create_engine
from sqlalchemy import Table, Column, ForeignKey, CheckConstraint
from sqlalchemy import String, Integer, Boolean, TIMESTAMP, Float
@ -942,7 +943,7 @@ class CalibreDB:
conn = conn or self.session.connection().connection.connection
try:
conn.create_function("title_sort", 1, _title_sort)
except OperationalError:
except sqliteOperationalError:
pass
@classmethod

View File

@ -37,7 +37,7 @@ from flask import Blueprint, request, flash, redirect, url_for, abort, Markup, R
from flask_babel import gettext as _
from flask_login import current_user, login_required
from sqlalchemy.exc import OperationalError, IntegrityError
from sqlite3 import OperationalError as sqliteOperationalError
# from sqlite3 import OperationalError as sqliteOperationalError
from . import constants, logger, isoLanguages, gdriveutils, uploader, helper, kobo_sync_status
from . import config, get_locale, ub, db
from . import calibre_db
@ -757,11 +757,11 @@ def edit_book(book_id):
edit_error = False
# create the function for sorting...
try:
calibre_db.update_title_sort(config)
except sqliteOperationalError as e:
log.error_or_exception(e)
calibre_db.session.rollback()
#try:
calibre_db.update_title_sort(config)
#except sqliteOperationalError as e:
# log.error_or_exception(e)
# calibre_db.session.rollback()
book = calibre_db.get_filtered_book(book_id, allow_show_archived=True)
# Book not found