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
141eb790
Commit
141eb790
authored
Feb 28, 2017
by
Jack Darlington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ignorable columns
parent
90aa269e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
2 deletions
+24
-2
config_edit.html
cps/templates/config_edit.html
+4
-1
ub.py
cps/ub.py
+8
-0
web.py
cps/web.py
+12
-1
No files found.
cps/templates/config_edit.html
View file @
141eb790
...
...
@@ -23,7 +23,10 @@
<label
for=
"config_random_books"
>
{{_('No. of random books to show')}}
</label>
<input
type=
"number"
min=
"1"
max=
"30"
class=
"form-control"
name=
"config_random_books"
id=
"config_random_books"
value=
"{% if content.config_random_books != None %}{{ content.config_random_books }}{% endif %}"
autocomplete=
"off"
>
</div>
<div
class=
"form-group"
>
<label
for=
"config_columns_to_ignore"
>
{{_('Regular expression for ignoring columns')}}
</label>
<input
type=
"text"
class=
"form-control"
name=
"config_columns_to_ignore"
id=
"config_columns_to_ignore"
value=
"{% if content.config_columns_to_ignore != None %}{{ content.config_columns_to_ignore }}{% endif %}"
autocomplete=
"off"
>
</div>
<div
class=
"form-group"
>
<label
for=
"config_title_regex"
>
{{_('Regular expression for title sorting')}}
</label>
<input
type=
"text"
class=
"form-control"
name=
"config_title_regex"
id=
"config_title_regex"
value=
"{% if content.config_title_regex != None %}{{ content.config_title_regex }}{% endif %}"
autocomplete=
"off"
>
...
...
cps/ub.py
View file @
141eb790
...
...
@@ -253,6 +253,7 @@ class Settings(Base):
config_anonbrowse
=
Column
(
SmallInteger
,
default
=
0
)
config_public_reg
=
Column
(
SmallInteger
,
default
=
0
)
config_default_role
=
Column
(
SmallInteger
,
default
=
0
)
config_columns_to_ignore
=
Column
(
String
)
def
__repr__
(
self
):
pass
...
...
@@ -279,6 +280,7 @@ class Config:
self
.
config_anonbrowse
=
data
.
config_anonbrowse
self
.
config_public_reg
=
data
.
config_public_reg
self
.
config_default_role
=
data
.
config_default_role
self
.
config_columns_to_ignore
=
data
.
config_columns_to_ignore
if
self
.
config_calibre_dir
is
not
None
:
self
.
db_configured
=
True
else
:
...
...
@@ -360,6 +362,12 @@ def migrate_Database():
conn
.
execute
(
"ALTER TABLE Settings ADD column `config_anonbrowse` SmallInteger DEFAULT 0"
)
conn
.
execute
(
"ALTER TABLE Settings ADD column `config_public_reg` SmallInteger DEFAULT 0"
)
session
.
commit
()
try
:
session
.
query
(
exists
()
.
where
(
Settings
.
config_columns_to_ignore
))
.
scalar
()
except
exc
.
OperationalError
:
conn
=
engine
.
connect
()
conn
.
execute
(
"ALTER TABLE Settings ADD column `config_columns_to_ignore` String DEFAULT ''"
)
session
.
commit
()
try
:
session
.
query
(
exists
()
.
where
(
Settings
.
config_default_role
))
.
scalar
()
session
.
commit
()
...
...
cps/web.py
View file @
141eb790
...
...
@@ -1006,7 +1006,16 @@ def show_book(id):
except
:
entries
.
languages
[
index
]
.
language_name
=
_
(
isoLanguages
.
get
(
part3
=
entries
.
languages
[
index
]
.
lang_code
)
.
name
)
cc
=
db
.
session
.
query
(
db
.
Custom_Columns
)
.
filter
(
db
.
Custom_Columns
.
datatype
.
notin_
(
db
.
cc_exceptions
))
.
all
()
tmpcc
=
db
.
session
.
query
(
db
.
Custom_Columns
)
.
filter
(
db
.
Custom_Columns
.
datatype
.
notin_
(
db
.
cc_exceptions
))
.
all
()
if
config
.
config_columns_to_ignore
:
cc
=
[]
for
col
in
tmpcc
:
r
=
re
.
compile
(
config
.
config_columns_to_ignore
)
if
r
.
match
(
col
.
label
):
c
.
append
(
col
)
else
:
cc
=
tmpcc
book_in_shelfs
=
[]
shelfs
=
ub
.
session
.
query
(
ub
.
BookShelf
)
.
filter
(
ub
.
BookShelf
.
book_id
==
id
)
.
all
()
for
entry
in
shelfs
:
...
...
@@ -1654,6 +1663,8 @@ def configuration_helper(origin):
reboot_required
=
True
if
"config_calibre_web_title"
in
to_save
:
content
.
config_calibre_web_title
=
to_save
[
"config_calibre_web_title"
]
if
"config_columns_to_ignore"
in
to_save
:
content
.
config_columns_to_ignore
=
to_save
[
"config_columns_to_ignore"
]
if
"config_title_regex"
in
to_save
:
if
content
.
config_title_regex
!=
to_save
[
"config_title_regex"
]:
content
.
config_title_regex
=
to_save
[
"config_title_regex"
]
...
...
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