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
d0e15da3
Commit
d0e15da3
authored
May 23, 2020
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lcase function
parent
b1b293a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
40 deletions
+22
-40
db.py
cps/db.py
+10
-8
web.py
cps/web.py
+2
-2
Calibre-Web TestSummary.html
test/Calibre-Web TestSummary.html
+10
-30
No files found.
cps/db.py
View file @
d0e15da3
...
...
@@ -546,14 +546,14 @@ class CalibreDB(threading.Thread):
def
get_typeahead
(
self
,
database
,
query
,
replace
=
(
''
,
''
),
tag_filter
=
true
()):
query
=
query
or
''
self
.
session
.
connection
()
.
connection
.
connection
.
create_function
(
"lower"
,
1
,
self
.
lcase
)
self
.
session
.
connection
()
.
connection
.
connection
.
create_function
(
"lower"
,
1
,
lcase
)
entries
=
self
.
session
.
query
(
database
)
.
filter
(
tag_filter
)
.
\
filter
(
func
.
lower
(
database
.
name
)
.
ilike
(
"
%
"
+
query
+
"
%
"
))
.
all
()
json_dumps
=
json
.
dumps
([
dict
(
name
=
r
.
name
.
replace
(
*
replace
))
for
r
in
entries
])
return
json_dumps
def
check_exists_book
(
self
,
authr
,
title
):
self
.
session
.
connection
()
.
connection
.
connection
.
create_function
(
"lower"
,
1
,
self
.
lcase
)
self
.
session
.
connection
()
.
connection
.
connection
.
create_function
(
"lower"
,
1
,
lcase
)
q
=
list
()
authorterms
=
re
.
split
(
r'\s*&\s*'
,
authr
)
for
authorterm
in
authorterms
:
...
...
@@ -565,7 +565,7 @@ class CalibreDB(threading.Thread):
# read search results from calibre-database and return it (function is used for feed and simple search
def
get_search_results
(
self
,
term
):
term
.
strip
()
.
lower
()
self
.
session
.
connection
()
.
connection
.
connection
.
create_function
(
"lower"
,
1
,
self
.
lcase
)
self
.
session
.
connection
()
.
connection
.
connection
.
create_function
(
"lower"
,
1
,
lcase
)
q
=
list
()
authorterms
=
re
.
split
(
"[, ]+"
,
term
)
for
authorterm
in
authorterms
:
...
...
@@ -642,8 +642,10 @@ class CalibreDB(threading.Thread):
self
.
engine
.
dispose
()
self
.
setup_db
(
config
,
app_db_path
)
def
lcase
(
self
,
s
):
try
:
return
unidecode
.
unidecode
(
s
.
lower
())
except
Exception
as
e
:
self
.
log
.
exception
(
e
)
def
lcase
(
s
):
try
:
return
unidecode
.
unidecode
(
s
.
lower
())
except
Exception
as
e
:
log
=
logger
.
create
()
log
.
exception
(
e
)
return
s
.
lower
()
cps/web.py
View file @
d0e15da3
...
...
@@ -590,7 +590,7 @@ def get_languages_json():
def
get_matching_tags
():
tag_dict
=
{
'tags'
:
[]}
q
=
calibre_db
.
session
.
query
(
db
.
Books
)
calibre_db
.
session
.
connection
()
.
connection
.
connection
.
create_function
(
"lower"
,
1
,
calibre_
db
.
lcase
)
calibre_db
.
session
.
connection
()
.
connection
.
connection
.
create_function
(
"lower"
,
1
,
db
.
lcase
)
author_input
=
request
.
args
.
get
(
'author_name'
)
or
''
title_input
=
request
.
args
.
get
(
'book_title'
)
or
''
include_tag_inputs
=
request
.
args
.
getlist
(
'include_tag'
)
or
''
...
...
@@ -1020,7 +1020,7 @@ def search():
def
advanced_search
():
# Build custom columns names
cc
=
get_cc_columns
()
calibre_db
.
session
.
connection
()
.
connection
.
connection
.
create_function
(
"lower"
,
1
,
calibre_
db
.
lcase
)
calibre_db
.
session
.
connection
()
.
connection
.
connection
.
create_function
(
"lower"
,
1
,
db
.
lcase
)
q
=
calibre_db
.
session
.
query
(
db
.
Books
)
.
filter
(
calibre_db
.
common_filters
())
.
order_by
(
db
.
Books
.
sort
)
include_tag_inputs
=
request
.
args
.
getlist
(
'include_tag'
)
...
...
test/Calibre-Web TestSummary.html
View file @
d0e15da3
...
...
@@ -36,17 +36,17 @@
<div
class=
"col-xs-12 col-sm-6"
>
<div
class=
"row"
>
<div
class=
"col-xs-6 col-md-6 col-sm-offset-3"
style=
"margin-top:50px;"
>
<p
class=
'text-justify attribute'
><strong>
Start Time:
</strong>
2020-05-22
07:43:1
2
</p>
<p
class=
'text-justify attribute'
><strong>
Start Time:
</strong>
2020-05-22
18:17:0
2
</p>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-xs-6 col-md-6 col-sm-offset-3"
>
<p
class=
'text-justify attribute'
><strong>
Stop Time:
</strong>
2020-05-22
08:41:06
</p>
<p
class=
'text-justify attribute'
><strong>
Stop Time:
</strong>
2020-05-22
19:14:53
</p>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-xs-6 col-md-6 col-sm-offset-3"
>
<p
class=
'text-justify attribute'
><strong>
Duration:
</strong>
48:
51
min
</p>
<p
class=
'text-justify attribute'
><strong>
Duration:
</strong>
48:
49
min
</p>
</div>
</div>
</div>
...
...
@@ -2219,8 +2219,8 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr
class=
"result['header']['style']"
>
<td>
test_visiblilitys.calibre_web_visibilitys
</td>
<td
class=
"text-center"
>
28
</td>
<td
class=
"text-center"
>
2
7
</td>
<td
class=
"text-center"
>
1
</td>
<td
class=
"text-center"
>
2
8
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
...
...
@@ -2410,31 +2410,11 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr
id=
'
ft20.21'
class=
'none bg-danger
'
>
<tr
id=
'
pt20.21'
class=
'hiddenRow bg-success
'
>
<td>
<div
class=
'testcase'
>
test_link_column_to_read_status
</div>
</td>
<td
colspan=
'6'
>
<div
class=
"text-center"
>
<a
class=
"popup_link text-center"
onfocus=
'blur()'
onclick=
"showTestDetail('div_ft20.21')"
>
FAIL
</a>
</div>
<!--css div popup start-->
<div
id=
'div_ft20.21'
class=
"popup_window test_output"
style=
"display:none;"
>
<div
class=
'close_button pull-right'
>
<button
type=
"button"
class=
"close"
aria-label=
"Close"
onfocus=
'this.blur();'
onclick=
"document.getElementById('div_ft20.21').style.display='none'"
><span
aria-hidden=
"true"
>
×
</span></button>
</div>
<div
class=
"text-left pull-left"
>
<pre
class=
"text-left"
>
Traceback (most recent call last):
File "/home/matthias/Entwicklung/calibre-web-test/test/test_visiblilitys.py", line 683, in test_link_column_to_read_status
self.assertEqual(len(details['cust_columns']), 0)
AssertionError: 1 != 0
</pre>
</div>
<div
class=
"clearfix"
></div>
</div>
<!--css div popup end-->
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
</tr>
...
...
@@ -2505,8 +2485,8 @@ AssertionError: 1 != 0</pre>
<tr
id=
'total_row'
class=
"text-center bg-grey"
>
<td>
Total
</td>
<td>
211
</td>
<td>
20
0
</td>
<td>
5
</td>
<td>
20
1
</td>
<td>
4
</td>
<td>
0
</td>
<td>
6
</td>
<td>
</td>
...
...
@@ -2734,7 +2714,7 @@ AssertionError: 1 != 0</pre>
</div>
<script>
drawCircle
(
20
0
,
5
,
0
,
6
);
drawCircle
(
20
1
,
4
,
0
,
6
);
</script>
</div>
...
...
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