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
897c1648
Commit
897c1648
authored
Aug 27, 2016
by
OzzieIsaacs
Committed by
GitHub
Aug 27, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add fix for #58 remove trailing spaces
parent
8a9b4e7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
web.py
cps/web.py
+4
-4
No files found.
cps/web.py
View file @
897c1648
...
@@ -256,7 +256,7 @@ def feed_osd():
...
@@ -256,7 +256,7 @@ def feed_osd():
@
app
.
route
(
"/feed/search"
,
methods
=
[
"GET"
])
@
app
.
route
(
"/feed/search"
,
methods
=
[
"GET"
])
@
requires_basic_auth_if_no_ano
@
requires_basic_auth_if_no_ano
def
feed_search
():
def
feed_search
():
term
=
request
.
args
.
get
(
"query"
)
term
=
request
.
args
.
get
(
"query"
)
.
strip
()
if
term
:
if
term
:
random
=
db
.
session
.
query
(
db
.
Books
)
.
order_by
(
func
.
random
())
.
limit
(
config
.
RANDOM_BOOKS
)
random
=
db
.
session
.
query
(
db
.
Books
)
.
order_by
(
func
.
random
())
.
limit
(
config
.
RANDOM_BOOKS
)
entries
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
or_
(
db
.
Books
.
tags
.
any
(
db
.
Tags
.
name
.
like
(
"
%
"
+
term
+
"
%
"
)),
db
.
Books
.
authors
.
any
(
db
.
Authors
.
name
.
like
(
"
%
"
+
term
+
"
%
"
)),
db
.
Books
.
title
.
like
(
"
%
"
+
term
+
"
%
"
)))
.
all
()
entries
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
or_
(
db
.
Books
.
tags
.
any
(
db
.
Tags
.
name
.
like
(
"
%
"
+
term
+
"
%
"
)),
db
.
Books
.
authors
.
any
(
db
.
Authors
.
name
.
like
(
"
%
"
+
term
+
"
%
"
)),
db
.
Books
.
title
.
like
(
"
%
"
+
term
+
"
%
"
)))
.
all
()
...
@@ -474,7 +474,7 @@ def admin():
...
@@ -474,7 +474,7 @@ def admin():
@
app
.
route
(
"/search"
,
methods
=
[
"GET"
])
@
app
.
route
(
"/search"
,
methods
=
[
"GET"
])
@
login_required_if_no_ano
@
login_required_if_no_ano
def
search
():
def
search
():
term
=
request
.
args
.
get
(
"query"
)
term
=
request
.
args
.
get
(
"query"
)
.
strip
()
if
term
:
if
term
:
random
=
db
.
session
.
query
(
db
.
Books
)
.
order_by
(
func
.
random
())
.
limit
(
config
.
RANDOM_BOOKS
)
random
=
db
.
session
.
query
(
db
.
Books
)
.
order_by
(
func
.
random
())
.
limit
(
config
.
RANDOM_BOOKS
)
entries
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
or_
(
db
.
Books
.
tags
.
any
(
db
.
Tags
.
name
.
like
(
"
%
"
+
term
+
"
%
"
)),
db
.
Books
.
series
.
any
(
db
.
Series
.
name
.
like
(
"
%
"
+
term
+
"
%
"
)),
db
.
Books
.
authors
.
any
(
db
.
Authors
.
name
.
like
(
"
%
"
+
term
+
"
%
"
)),
db
.
Books
.
title
.
like
(
"
%
"
+
term
+
"
%
"
)))
.
all
()
entries
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
or_
(
db
.
Books
.
tags
.
any
(
db
.
Tags
.
name
.
like
(
"
%
"
+
term
+
"
%
"
)),
db
.
Books
.
series
.
any
(
db
.
Series
.
name
.
like
(
"
%
"
+
term
+
"
%
"
)),
db
.
Books
.
authors
.
any
(
db
.
Authors
.
name
.
like
(
"
%
"
+
term
+
"
%
"
)),
db
.
Books
.
title
.
like
(
"
%
"
+
term
+
"
%
"
)))
.
all
()
...
@@ -489,8 +489,8 @@ def advanced_search():
...
@@ -489,8 +489,8 @@ def advanced_search():
q
=
db
.
session
.
query
(
db
.
Books
)
q
=
db
.
session
.
query
(
db
.
Books
)
include_tag_inputs
=
request
.
args
.
getlist
(
'include_tag'
)
include_tag_inputs
=
request
.
args
.
getlist
(
'include_tag'
)
exclude_tag_inputs
=
request
.
args
.
getlist
(
'exclude_tag'
)
exclude_tag_inputs
=
request
.
args
.
getlist
(
'exclude_tag'
)
author_name
=
request
.
args
.
get
(
"author_name"
)
author_name
=
request
.
args
.
get
(
"author_name"
)
.
strip
()
book_title
=
request
.
args
.
get
(
"book_title"
)
book_title
=
request
.
args
.
get
(
"book_title"
)
.
strip
()
if
include_tag_inputs
or
exclude_tag_inputs
or
author_name
or
book_title
:
if
include_tag_inputs
or
exclude_tag_inputs
or
author_name
or
book_title
:
searchterm
=
[]
searchterm
=
[]
searchterm
.
extend
((
author_name
,
book_title
))
searchterm
.
extend
((
author_name
,
book_title
))
...
...
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