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
152f7857
Commit
152f7857
authored
Dec 01, 2017
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #397
parent
cbb236ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
helper.py
cps/helper.py
+2
-2
web.py
cps/web.py
+5
-5
No files found.
cps/helper.py
View file @
152f7857
...
...
@@ -292,9 +292,9 @@ def get_valid_filename(value, replace_whitespace=True):
def
get_sorted_author
(
value
):
regexes
=
[
"^(JR|SR)
\
.?$"
,
"^I{1,3}
\
.?$"
,
"^IV
\
.?$"
]
combined
=
"("
+
")|("
.
join
(
regexes
)
+
")"
try
:
regexes
=
[
"^(JR|SR)
\
.?$"
,
"^I{1,3}
\
.?$"
,
"^IV
\
.?$"
]
combined
=
"("
+
")|("
.
join
(
regexes
)
+
")"
value
=
value
.
split
(
" "
)
if
re
.
match
(
combined
,
value
[
-
1
]
.
upper
()):
value2
=
value
[
-
2
]
+
", "
+
" "
.
join
(
value
[:
-
2
])
+
" "
+
value
[
-
1
]
...
...
cps/web.py
View file @
152f7857
...
...
@@ -2931,7 +2931,7 @@ def edit_book(book_id):
edited_books_id
.
add
(
book
.
id
)
input_authors
=
to_save
[
"author_name"
]
.
split
(
'&'
)
input_authors
=
map
(
lambda
it
:
it
.
strip
()
.
replace
(
','
,
'|'
),
input_authors
)
input_authors
=
list
(
map
(
lambda
it
:
it
.
strip
()
.
replace
(
','
,
'|'
),
input_authors
)
)
# we have all author names now
if
input_authors
==
[
''
]:
input_authors
=
[
_
(
u'unknown'
)]
# prevent empty Author
...
...
@@ -2969,7 +2969,7 @@ def edit_book(book_id):
book
.
comments
.
append
(
db
.
Comments
(
text
=
to_save
[
"description"
],
book
=
book
.
id
))
input_tags
=
to_save
[
"tags"
]
.
split
(
','
)
input_tags
=
map
(
lambda
it
:
it
.
strip
(),
input_tags
)
input_tags
=
list
(
map
(
lambda
it
:
it
.
strip
(),
input_tags
)
)
modify_database_object
(
input_tags
,
book
.
tags
,
db
.
Tags
,
db
.
session
,
'tags'
)
input_series
=
[
to_save
[
"series"
]
.
strip
()]
...
...
@@ -2977,7 +2977,7 @@ def edit_book(book_id):
modify_database_object
(
input_series
,
book
.
series
,
db
.
Series
,
db
.
session
,
'series'
)
input_languages
=
to_save
[
"languages"
]
.
split
(
','
)
input_languages
=
map
(
lambda
it
:
it
.
strip
()
.
lower
(),
input_languages
)
input_languages
=
list
(
map
(
lambda
it
:
it
.
strip
()
.
lower
(),
input_languages
)
)
if
to_save
[
"pubdate"
]:
try
:
...
...
@@ -3089,7 +3089,7 @@ def edit_book(book_id):
db
.
session
.
delete
(
del_cc
)
else
:
input_tags
=
to_save
[
cc_string
]
.
split
(
','
)
input_tags
=
map
(
lambda
it
:
it
.
strip
(),
input_tags
)
input_tags
=
list
(
map
(
lambda
it
:
it
.
strip
(),
input_tags
)
)
modify_database_object
(
input_tags
,
getattr
(
book
,
cc_string
),
db
.
cc_classes
[
c
.
id
],
db
.
session
,
'custom'
)
db
.
session
.
commit
()
author_names
=
[]
...
...
@@ -3234,7 +3234,7 @@ def upload():
db
.
session
.
commit
()
input_tags
=
tags
.
split
(
','
)
input_tags
=
map
(
lambda
it
:
it
.
strip
(),
input_tags
)
input_tags
=
list
(
map
(
lambda
it
:
it
.
strip
(),
input_tags
)
)
modify_database_object
(
input_tags
,
db_book
.
tags
,
db
.
Tags
,
db
.
session
,
'tags'
)
if
db_language
is
not
None
:
# display Full name instead of iso639.part3
...
...
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