Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
e5f754ed
Commit
e5f754ed
authored
Jan 10, 2021
by
Ozzie Isaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved session handling
parent
263a8f90
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
391 additions
and
220 deletions
+391
-220
db.py
cps/db.py
+1
-1
editbooks.py
cps/editbooks.py
+10
-4
convert.py
cps/tasks/convert.py
+0
-1
Calibre-Web TestSummary_Linux.html
test/Calibre-Web TestSummary_Linux.html
+380
-214
No files found.
cps/db.py
View file @
e5f754ed
...
...
@@ -545,7 +545,7 @@ class CalibreDB():
backref
=
'books'
))
cls
.
session_factory
=
scoped_session
(
sessionmaker
(
autocommit
=
False
,
autoflush
=
Fals
e
,
autoflush
=
Tru
e
,
bind
=
cls
.
engine
))
for
inst
in
cls
.
instances
:
inst
.
initSession
()
...
...
cps/editbooks.py
View file @
e5f754ed
...
...
@@ -31,7 +31,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
.
import
constants
,
logger
,
isoLanguages
,
gdriveutils
,
uploader
,
helper
from
.
import
config
,
get_locale
,
ub
,
db
from
.
import
calibre_db
...
...
@@ -310,7 +310,6 @@ def delete_book(book_id, book_format, jsonResponse):
def
render_edit_book
(
book_id
):
calibre_db
.
update_title_sort
(
config
)
cc
=
calibre_db
.
session
.
query
(
db
.
Custom_Columns
)
.
filter
(
db
.
Custom_Columns
.
datatype
.
notin_
(
db
.
cc_exceptions
))
.
all
()
book
=
calibre_db
.
get_filtered_book
(
book_id
,
allow_show_archived
=
True
)
if
not
book
:
...
...
@@ -607,12 +606,19 @@ def upload_cover(request, book):
@
edit_required
def
edit_book
(
book_id
):
modif_date
=
False
# create the function for sorting...
try
:
calibre_db
.
update_title_sort
(
config
)
except
sqliteOperationalError
as
e
:
log
.
debug_or_exception
(
e
)
calibre_db
.
session
.
rollback
()
# Show form
if
request
.
method
!=
'POST'
:
return
render_edit_book
(
book_id
)
# create the function for sorting...
calibre_db
.
update_title_sort
(
config
)
book
=
calibre_db
.
get_filtered_book
(
book_id
,
allow_show_archived
=
True
)
# Book not found
...
...
cps/tasks/convert.py
View file @
e5f754ed
...
...
@@ -123,7 +123,6 @@ class TaskConvert(CalibreTask):
book
=
book_id
,
uncompressed_size
=
os
.
path
.
getsize
(
file_path
+
format_new_ext
))
try
:
local_db
.
session
.
merge
(
new_format
)
local_db
.
session
.
flush
()
local_db
.
session
.
commit
()
except
SQLAlchemyError
as
e
:
local_db
.
session
.
rollback
()
...
...
test/Calibre-Web TestSummary_Linux.html
View file @
e5f754ed
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment