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
e32b0174
Commit
e32b0174
authored
Sep 06, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Test revert global Session"
This reverts commit
393869e5
.
parent
393869e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
db.py
cps/db.py
+3
-0
convert.py
cps/tasks/convert.py
+4
-4
No files found.
cps/db.py
View file @
e32b0174
...
...
@@ -48,6 +48,7 @@ try:
except
ImportError
:
use_unidecode
=
False
Session
=
None
cc_exceptions
=
[
'datetime'
,
'comments'
,
'composite'
,
'series'
]
cc_classes
=
{}
...
...
@@ -409,6 +410,7 @@ class CalibreDB():
def
setup_db
(
self
,
config
,
app_db_path
):
self
.
config
=
config
self
.
dispose
()
global
Session
if
not
config
.
config_calibre_dir
:
config
.
invalidate
()
...
...
@@ -678,6 +680,7 @@ class CalibreDB():
conn
.
create_function
(
"title_sort"
,
1
,
_title_sort
)
def
dispose
(
self
):
# global session
old_session
=
self
.
session
self
.
session
=
None
...
...
cps/tasks/convert.py
View file @
e32b0174
...
...
@@ -53,7 +53,7 @@ class TaskConvert(CalibreTask):
def
_convert_ebook_format
(
self
):
error_message
=
None
#
local_session = db.Session()
local_session
=
db
.
Session
()
file_path
=
self
.
file_path
book_id
=
self
.
bookid
format_old_ext
=
u'.'
+
self
.
settings
[
'old_book_format'
]
.
lower
()
...
...
@@ -94,10 +94,10 @@ class TaskConvert(CalibreTask):
book_format
=
self
.
settings
[
'new_book_format'
]
.
upper
(),
book
=
book_id
,
uncompressed_size
=
os
.
path
.
getsize
(
file_path
+
format_new_ext
))
try
:
calibre_db
.
session
.
merge
(
new_format
)
calibre_db
.
session
.
commit
()
local_
session
.
merge
(
new_format
)
local_
session
.
commit
()
except
SQLAlchemyError
as
e
:
calibre_db
.
session
.
rollback
()
local_
session
.
rollback
()
log
.
error
(
"Database error:
%
s"
,
e
)
return
self
.
results
[
'path'
]
=
cur_book
.
path
...
...
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