Always catch sqlite create_function error
This commit is contained in:
parent
bc96ff9a39
commit
8421a17a82
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user