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
4f1754c1
Commit
4f1754c1
authored
Jul 08, 2018
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved errorhandling during editing of books
parent
fbe2f538
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
165 additions
and
156 deletions
+165
-156
web.py
cps/web.py
+165
-156
No files found.
cps/web.py
View file @
4f1754c1
...
@@ -1649,6 +1649,8 @@ def shutdown():
...
@@ -1649,6 +1649,8 @@ def shutdown():
db
.
engine
.
dispose
()
db
.
engine
.
dispose
()
ub
.
session
.
close
()
ub
.
session
.
close
()
ub
.
engine
.
dispose
()
ub
.
engine
.
dispose
()
# stop gevent server
# gevent_server.stop()
# stop tornado server
# stop tornado server
server
=
IOLoop
.
instance
()
server
=
IOLoop
.
instance
()
server
.
add_callback
(
server
.
stop
)
server
.
add_callback
(
server
.
stop
)
...
@@ -3030,6 +3032,7 @@ def edit_book(book_id):
...
@@ -3030,6 +3032,7 @@ def edit_book(book_id):
is_format
=
db
.
session
.
query
(
db
.
Data
)
.
filter
(
db
.
Data
.
book
==
book_id
)
.
filter
(
db
.
Data
.
format
==
file_ext
.
upper
())
.
first
()
is_format
=
db
.
session
.
query
(
db
.
Data
)
.
filter
(
db
.
Data
.
book
==
book_id
)
.
filter
(
db
.
Data
.
format
==
file_ext
.
upper
())
.
first
()
if
is_format
:
if
is_format
:
# Format entry already exists, no need to update the database
# Format entry already exists, no need to update the database
app
.
logger
.
info
(
'Bokk format already existing'
)
pass
pass
else
:
else
:
db_format
=
db
.
Data
(
book_id
,
file_ext
.
upper
(),
file_size
,
file_name
)
db_format
=
db
.
Data
(
book_id
,
file_ext
.
upper
(),
file_size
,
file_name
)
...
@@ -3037,6 +3040,7 @@ def edit_book(book_id):
...
@@ -3037,6 +3040,7 @@ def edit_book(book_id):
to_save
=
request
.
form
.
to_dict
()
to_save
=
request
.
form
.
to_dict
()
try
:
if
book
.
title
!=
to_save
[
"book_title"
]:
if
book
.
title
!=
to_save
[
"book_title"
]:
book
.
title
=
to_save
[
"book_title"
]
book
.
title
=
to_save
[
"book_title"
]
edited_books_id
.
add
(
book
.
id
)
edited_books_id
.
add
(
book
.
id
)
...
@@ -3219,6 +3223,11 @@ def edit_book(book_id):
...
@@ -3219,6 +3223,11 @@ def edit_book(book_id):
flash
(
error
,
category
=
"error"
)
flash
(
error
,
category
=
"error"
)
return
render_title_template
(
'book_edit.html'
,
book
=
book
,
authors
=
author_names
,
cc
=
cc
,
return
render_title_template
(
'book_edit.html'
,
book
=
book
,
authors
=
author_names
,
cc
=
cc
,
title
=
_
(
u"edit metadata"
))
title
=
_
(
u"edit metadata"
))
except
Exception
as
e
:
app
.
logger
.
exception
(
e
)
db
.
session
.
rollback
()
flash
(
_
(
"Error editing book, please check logfile for details"
),
category
=
"error"
)
return
redirect
(
url_for
(
'show_book'
,
book_id
=
book
.
id
))
def
save_cover
(
url
,
book_path
):
def
save_cover
(
url
,
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