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
bda3055a
Commit
bda3055a
authored
Apr 05, 2016
by
Cervinko Cera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvements for pdf upload function
parent
33246697
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
helper.py
cps/helper.py
+5
-3
index.html
cps/templates/index.html
+0
-1
web.py
cps/web.py
+3
-0
No files found.
cps/helper.py
View file @
bda3055a
...
...
@@ -189,11 +189,13 @@ def update_dir_stucture(book_id):
new_titledir
=
get_valid_filename
(
book
.
title
,
False
)
+
" ("
+
str
(
book_id
)
+
")"
if
titledir
!=
new_titledir
:
os
.
rename
(
path
,
os
.
path
.
join
(
os
.
path
.
dirname
(
path
),
new_titledir
))
path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
path
),
new_titledir
)
new_title_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
path
),
new_titledir
)
os
.
rename
(
path
,
new_title_path
)
path
=
new_title_path
book
.
path
=
book
.
path
.
split
(
"/"
)[
0
]
+
"/"
+
new_titledir
if
authordir
!=
new_authordir
:
os
.
renames
(
path
,
os
.
path
.
join
(
os
.
path
.
join
(
config
.
DB_ROOT
,
new_authordir
),
os
.
path
.
basename
(
path
)))
new_author_path
=
os
.
path
.
join
(
os
.
path
.
join
(
config
.
DB_ROOT
,
new_authordir
),
os
.
path
.
basename
(
path
))
os
.
renames
(
path
,
new_author_path
)
book
.
path
=
new_authordir
+
"/"
+
book
.
path
.
split
(
"/"
)[
1
]
db
.
session
.
commit
()
cps/templates/index.html
View file @
bda3055a
...
...
@@ -39,7 +39,6 @@
<div
class=
"discover load-more"
>
<h2>
{{title}}
</h2>
<div
class=
"row"
>
{% for entry in entries %}
<div
class=
"col-sm-3 col-lg-2 col-xs-6 book"
>
<div
class=
"cover"
>
...
...
cps/web.py
View file @
bda3055a
...
...
@@ -760,6 +760,9 @@ def upload():
if
fileextension
.
upper
()
==
".PDF"
:
title
=
filename_root
author
=
"Unknown"
else
:
flash
(
"Upload is only available for PDF files"
,
category
=
"error"
)
return
redirect
(
url_for
(
'index'
))
title_dir
=
helper
.
get_valid_filename
(
title
,
False
)
author_dir
=
helper
.
get_valid_filename
(
author
.
decode
(
'utf-8'
),
False
)
...
...
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