Fix #2757 (Sqlalchemy >1.30 <1.4.24 wasn't supported anymore)
This commit is contained in:
parent
f2369609e8
commit
fe4dc1bb8f
|
@ -993,7 +993,12 @@ class CalibreDB:
|
||||||
title = title[len(prep):] + ', ' + prep
|
title = title[len(prep):] + ', ' + prep
|
||||||
return title.strip()
|
return title.strip()
|
||||||
|
|
||||||
conn = conn or self.session.connection().connection.driver_connection
|
try:
|
||||||
|
# sqlalchemy <1.4.24
|
||||||
|
conn = conn or self.session.connection().connection.driver_connection
|
||||||
|
except AttributeError:
|
||||||
|
# sqlalchemy >1.4.24 and sqlalchemy 2.0
|
||||||
|
conn = conn or self.session.connection().connection.connection
|
||||||
try:
|
try:
|
||||||
conn.create_function("title_sort", 1, _title_sort)
|
conn.create_function("title_sort", 1, _title_sort)
|
||||||
except sqliteOperationalError:
|
except sqliteOperationalError:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user