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
9144a7ce
Commit
9144a7ce
authored
Mar 08, 2019
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for sqlalchemy 1.3
parent
feb6a71f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
120 additions
and
82 deletions
+120
-82
admin.py
cps/admin.py
+9
-9
opds.py
cps/opds.py
+6
-5
config_edit.html
cps/templates/config_edit.html
+42
-42
index.html
cps/templates/index.html
+12
-1
list.html
cps/templates/list.html
+2
-1
ub.py
cps/ub.py
+5
-1
web.py
cps/web.py
+44
-23
No files found.
cps/admin.py
View file @
9144a7ce
...
...
@@ -325,7 +325,7 @@ def configuration_helper(origin):
'credential'
:
os
.
path
.
join
(
config
.
get_main_dir
,
'gdrive_credentials'
)})
else
:
flash
(
_
(
u'client_secrets.json is not configured for web application'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
gfeature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
...
...
@@ -351,7 +351,7 @@ def configuration_helper(origin):
else
:
ub
.
session
.
commit
()
flash
(
_
(
u'Keyfile location is not valid, please enter correct path'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
...
...
@@ -363,7 +363,7 @@ def configuration_helper(origin):
else
:
ub
.
session
.
commit
()
flash
(
_
(
u'Certfile location is not valid, please enter correct path'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
content
.
config_uploading
=
0
...
...
@@ -388,7 +388,7 @@ def configuration_helper(origin):
if
"config_ldap_provider_url"
not
in
to_save
or
"config_ldap_dn"
not
in
to_save
:
ub
.
session
.
commit
()
flash
(
_
(
u'Please enter a LDAP provider and a DN'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
else
:
...
...
@@ -446,7 +446,7 @@ def configuration_helper(origin):
else
:
ub
.
session
.
commit
()
flash
(
_
(
u'Logfile location is not valid, please enter correct path'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
else
:
...
...
@@ -460,7 +460,7 @@ def configuration_helper(origin):
content
.
config_rarfile_location
=
to_save
[
"config_rarfile_location"
]
.
strip
()
else
:
flash
(
check
[
1
],
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
))
try
:
if
content
.
config_use_google_drive
and
is_gdrive_ready
()
and
not
\
...
...
@@ -477,14 +477,14 @@ def configuration_helper(origin):
# logging.getLogger("uploader").setLevel(config.config_log_level)
except
Exception
as
e
:
flash
(
e
,
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
if
db_change
:
reload
(
db
)
if
not
db
.
setup_db
():
flash
(
_
(
u'DB location is not valid, please enter correct path'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
if
reboot_required
:
...
...
@@ -498,7 +498,7 @@ def configuration_helper(origin):
gdrivefolders
=
listRootFolders
()
else
:
gdrivefolders
=
list
()
return
render_title_template
(
"config_edit.html"
,
origin
=
origin
,
success
=
success
,
con
tent
=
config
,
return
render_title_template
(
"config_edit.html"
,
origin
=
origin
,
success
=
success
,
con
fig
=
config
,
show_authenticate_google_drive
=
not
is_gdrive_ready
(),
gdriveError
=
gdriveError
,
gdrivefolders
=
gdrivefolders
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
...
...
cps/opds.py
View file @
9144a7ce
...
...
@@ -31,12 +31,13 @@ import ub
from
flask_login
import
current_user
from
functools
import
wraps
from
web
import
login_required_if_no_ano
,
fill_indexpage
,
common_filters
,
get_search_results
,
render_read_books
from
sqlalchemy.sql.expression
import
func
from
sqlalchemy.sql.expression
import
func
,
text
import
helper
from
werkzeug.security
import
check_password_hash
from
werkzeug.datastructures
import
Headers
from
web
import
download_required
import
sys
try
:
from
urllib.parse
import
quote
except
ImportError
:
...
...
@@ -138,7 +139,7 @@ def feed_hot():
def
feed_authorindex
():
off
=
request
.
args
.
get
(
"offset"
)
or
0
entries
=
db
.
session
.
query
(
db
.
Authors
)
.
join
(
db
.
books_authors_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_authors_link.author'
)
.
order_by
(
db
.
Authors
.
sort
)
.
limit
(
config
.
config_books_per_page
)
.
offset
(
off
)
.
group_by
(
text
(
'books_authors_link.author'
)
)
.
order_by
(
db
.
Authors
.
sort
)
.
limit
(
config
.
config_books_per_page
)
.
offset
(
off
)
pagination
=
Pagination
((
int
(
off
)
/
(
int
(
config
.
config_books_per_page
))
+
1
),
config
.
config_books_per_page
,
len
(
db
.
session
.
query
(
db
.
Authors
)
.
all
()))
return
render_xml_template
(
'feed.xml'
,
listelements
=
entries
,
folder
=
'opds.feed_author'
,
pagination
=
pagination
)
...
...
@@ -158,7 +159,7 @@ def feed_author(book_id):
def
feed_publisherindex
():
off
=
request
.
args
.
get
(
"offset"
)
or
0
entries
=
db
.
session
.
query
(
db
.
Publishers
)
.
join
(
db
.
books_publishers_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_publishers_link.publisher'
)
.
order_by
(
db
.
Publishers
.
sort
)
.
limit
(
config
.
config_books_per_page
)
.
offset
(
off
)
.
group_by
(
text
(
'books_publishers_link.publisher'
)
)
.
order_by
(
db
.
Publishers
.
sort
)
.
limit
(
config
.
config_books_per_page
)
.
offset
(
off
)
pagination
=
Pagination
((
int
(
off
)
/
(
int
(
config
.
config_books_per_page
))
+
1
),
config
.
config_books_per_page
,
len
(
db
.
session
.
query
(
db
.
Publishers
)
.
all
()))
return
render_xml_template
(
'feed.xml'
,
listelements
=
entries
,
folder
=
'opds.feed_publisher'
,
pagination
=
pagination
)
...
...
@@ -179,7 +180,7 @@ def feed_publisher(book_id):
def
feed_categoryindex
():
off
=
request
.
args
.
get
(
"offset"
)
or
0
entries
=
db
.
session
.
query
(
db
.
Tags
)
.
join
(
db
.
books_tags_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_tags_link.tag'
)
.
order_by
(
db
.
Tags
.
name
)
.
offset
(
off
)
.
limit
(
config
.
config_books_per_page
)
.
group_by
(
text
(
'books_tags_link.tag'
)
)
.
order_by
(
db
.
Tags
.
name
)
.
offset
(
off
)
.
limit
(
config
.
config_books_per_page
)
pagination
=
Pagination
((
int
(
off
)
/
(
int
(
config
.
config_books_per_page
))
+
1
),
config
.
config_books_per_page
,
len
(
db
.
session
.
query
(
db
.
Tags
)
.
all
()))
return
render_xml_template
(
'feed.xml'
,
listelements
=
entries
,
folder
=
'opds.feed_category'
,
pagination
=
pagination
)
...
...
@@ -199,7 +200,7 @@ def feed_category(book_id):
def
feed_seriesindex
():
off
=
request
.
args
.
get
(
"offset"
)
or
0
entries
=
db
.
session
.
query
(
db
.
Series
)
.
join
(
db
.
books_series_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_series_link.series'
)
.
order_by
(
db
.
Series
.
sort
)
.
offset
(
off
)
.
all
()
.
group_by
(
text
(
'books_series_link.series'
)
)
.
order_by
(
db
.
Series
.
sort
)
.
offset
(
off
)
.
all
()
pagination
=
Pagination
((
int
(
off
)
/
(
int
(
config
.
config_books_per_page
))
+
1
),
config
.
config_books_per_page
,
len
(
db
.
session
.
query
(
db
.
Series
)
.
all
()))
return
render_xml_template
(
'feed.xml'
,
listelements
=
entries
,
folder
=
'opds.feed_series'
,
pagination
=
pagination
)
...
...
cps/templates/config_edit.html
View file @
9144a7ce
This diff is collapsed.
Click to expand it.
cps/templates/index.html
View file @
9144a7ce
...
...
@@ -4,7 +4,6 @@
<div
class=
"discover random-books"
>
<h2
class=
"random-books"
>
{{_('Discover (Random Books)')}}
</h2>
<div
class=
"row"
>
{% for entry in random %}
<div
class=
"col-sm-3 col-lg-2 col-xs-6 book"
id=
"books_rand"
>
<div
class=
"cover"
>
...
...
@@ -48,6 +47,18 @@
{% endif %}
<div
class=
"discover load-more"
>
<h2
class=
"{{title}}"
>
{{_(title)}}
</h2>
<div
class=
"filterheader hidden-xs hidden-sm"
>
<a
id=
"new"
class=
"btn btn-primary"
href=
"{{url_for('web.newest_books')}}"
><span
class=
"glyphicon glyphicon-sort-by-order"
></span></a>
<a
id=
"old"
class=
"btn btn-primary"
href=
"{{url_for('web.oldest_books')}}"
><span
class=
"glyphicon glyphicon-sort-by-order-alt"
></span></a>
<a
id=
"asc"
class=
"btn btn-primary"
href=
"{{url_for('web.titles_ascending')}}"
><span
class=
"glyphicon glyphicon-font"
></span><span
class=
"glyphicon glyphicon-sort-by-alphabet"
></span></a>
<a
id=
"desc"
class=
"btn btn-primary"
href=
"{{url_for('web.titles_descending')}}"
><span
class=
"glyphicon glyphicon-font"
></span><span
class=
"glyphicon glyphicon-sort-by-alphabet-alt"
></span></a>
<a
id=
"pub_new"
class=
"btn btn-primary"
href=
"{{url_for('web.titles_descending')}}"
><span
class=
"glyphicon glyphicon-calendar"
></span><span
class=
"glyphicon glyphicon-sort-by-order"
></a>
<a
id=
"pub_old"
class=
"btn btn-primary"
href=
"{{url_for('web.titles_descending')}}"
><span
class=
"glyphicon glyphicon-calendar"
></span><span
class=
"glyphicon glyphicon-sort-by-order-alt"
></a>
<div
class=
"btn-group character"
role=
"group"
>
<a
id=
"no_shelf"
class=
"btn btn-primary"
href=
"{{url_for('web.titles_descending')}}"
><span
class=
"glyphicon glyphicon-list"
></span><b>
?
</b></a>
<div
id=
"all"
class=
"btn btn-primary"
>
{{_('All')}}
</div>
</div>
</div>
<div
class=
"row"
>
{% if entries[0] %}
{% for entry in entries %}
...
...
cps/templates/list.html
View file @
9144a7ce
{% extends "layout.html" %}
{% block body %}
<h1
class=
"{{page}}"
>
{{_(title)}}
</h1>
<div
class=
"container"
>
<div
class=
"filterheader hidden-xs hidden-sm"
>
<button
id=
"desc"
class=
"btn btn-success"
><span
class=
"glyphicon glyphicon-sort-by-alphabet"
></span></button>
<button
id=
"asc"
class=
"btn btn-success"
><span
class=
"glyphicon glyphicon-sort-by-alphabet-alt"
></span></button>
...
...
@@ -12,6 +12,7 @@
{% endfor %}
</div>
</div>
<div
class=
"container"
>
<div
id=
"list"
class=
"col-xs-12 col-sm-6"
>
{% for entry in entries %}
<div
class=
"row"
data-id=
"{% if entry[0].sort %}{{entry[0].sort}}{% else %}{{entry[0].name}}{% endif %}"
>
...
...
cps/ub.py
View file @
9144a7ce
...
...
@@ -70,6 +70,7 @@ SIDEBAR_RECENT = 512
SIDEBAR_SORTED
=
1024
MATURE_CONTENT
=
2048
SIDEBAR_PUBLISHER
=
4096
SIDEBAR_RATING
=
8192
UPDATE_STABLE
=
0
AUTO_UPDATE_STABLE
=
1
...
...
@@ -139,6 +140,9 @@ def get_sidebar_config(kwargs=[]):
"visibility"
:
SIDEBAR_LANGUAGE
,
'public'
:
(
g
.
user
.
filter_language
()
==
'all'
),
"page"
:
"language"
,
"show_text"
:
_
(
'Show language selection'
),
"config_show"
:
True
})
sidebar
.
append
({
"glyph"
:
"glyphicon-star-empty"
,
"text"
:
_
(
'Ratings'
),
"link"
:
'web.ratings_list'
,
"id"
:
"rate"
,
"visibility"
:
SIDEBAR_RATING
,
'public'
:
True
,
"page"
:
"rating"
,
"show_text"
:
_
(
'Show ratings selection'
),
"config_show"
:
True
})
return
sidebar
...
...
@@ -835,7 +839,7 @@ def create_admin_user():
user
.
role
=
ROLE_USER
+
ROLE_ADMIN
+
ROLE_DOWNLOAD
+
ROLE_UPLOAD
+
ROLE_EDIT
+
ROLE_DELETE_BOOKS
+
ROLE_PASSWD
user
.
sidebar_view
=
DETAIL_RANDOM
+
SIDEBAR_LANGUAGE
+
SIDEBAR_SERIES
+
SIDEBAR_CATEGORY
+
SIDEBAR_HOT
+
\
SIDEBAR_RANDOM
+
SIDEBAR_AUTHOR
+
SIDEBAR_BEST_RATED
+
SIDEBAR_READ_AND_UNREAD
+
SIDEBAR_RECENT
+
\
SIDEBAR_SORTED
+
SIDEBAR_PUBLISHER
SIDEBAR_SORTED
+
+
MATURE_CONTENT
+
SIDEBAR_PUBLISHER
+
SIDEBAR_RATING
user
.
password
=
generate_password_hash
(
DEFAULT_PASS
)
...
...
cps/web.py
View file @
9144a7ce
...
...
@@ -501,36 +501,27 @@ def index(page):
@
web
.
route
(
'/books/newest/page/<int:page>'
)
@
login_required_if_no_ano
def
newest_books
(
page
):
if
current_user
.
show_sorted
():
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
[
db
.
Books
.
pubdate
.
desc
()])
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Newest Books"
),
page
=
"newest"
)
else
:
abort
(
404
)
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
[
db
.
Books
.
pubdate
.
desc
()])
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Newest Books"
),
page
=
"newest"
)
@
web
.
route
(
'/books/oldest'
,
defaults
=
{
'page'
:
1
})
@
web
.
route
(
'/books/oldest/page/<int:page>'
)
@
login_required_if_no_ano
def
oldest_books
(
page
):
if
current_user
.
show_sorted
():
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
[
db
.
Books
.
pubdate
])
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Oldest Books"
),
page
=
"oldest"
)
else
:
abort
(
404
)
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
[
db
.
Books
.
pubdate
])
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Oldest Books"
),
page
=
"oldest"
)
@
web
.
route
(
'/books/a-z'
,
defaults
=
{
'page'
:
1
})
@
web
.
route
(
'/books/a-z/page/<int:page>'
)
@
login_required_if_no_ano
def
titles_ascending
(
page
):
if
current_user
.
show_sorted
():
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
[
db
.
Books
.
sort
])
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Books (A-Z)"
),
page
=
"a-z"
)
else
:
abort
(
404
)
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
[
db
.
Books
.
sort
])
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Books (A-Z)"
),
page
=
"a-z"
)
@
web
.
route
(
'/books/z-a'
,
defaults
=
{
'page'
:
1
})
...
...
@@ -605,7 +596,7 @@ def author_list():
if
current_user
.
check_visibility
(
ub
.
SIDEBAR_AUTHOR
):
entries
=
db
.
session
.
query
(
db
.
Authors
,
func
.
count
(
'books_authors_link.book'
)
.
label
(
'count'
))
\
.
join
(
db
.
books_authors_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_authors_link.author'
)
.
order_by
(
db
.
Authors
.
sort
)
.
all
()
.
group_by
(
text
(
'books_authors_link.author'
)
)
.
order_by
(
db
.
Authors
.
sort
)
.
all
()
charlist
=
db
.
session
.
query
(
func
.
upper
(
func
.
substr
(
db
.
Authors
.
sort
,
1
,
1
))
.
label
(
'char'
))
\
.
join
(
db
.
books_authors_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
func
.
upper
(
func
.
substr
(
db
.
Authors
.
sort
,
1
,
1
)))
.
all
()
...
...
@@ -650,7 +641,7 @@ def publisher_list():
if
current_user
.
check_visibility
(
ub
.
SIDEBAR_PUBLISHER
):
entries
=
db
.
session
.
query
(
db
.
Publishers
,
func
.
count
(
'books_publishers_link.book'
)
.
label
(
'count'
))
\
.
join
(
db
.
books_publishers_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_publishers_link.publisher'
)
.
order_by
(
db
.
Publishers
.
sort
)
.
all
()
.
group_by
(
text
(
'books_publishers_link.publisher'
)
)
.
order_by
(
db
.
Publishers
.
sort
)
.
all
()
charlist
=
db
.
session
.
query
(
func
.
upper
(
func
.
substr
(
db
.
Publishers
.
name
,
1
,
1
))
.
label
(
'char'
))
\
.
join
(
db
.
books_publishers_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
func
.
upper
(
func
.
substr
(
db
.
Publishers
.
name
,
1
,
1
)))
.
all
()
...
...
@@ -704,7 +695,7 @@ def series_list():
if
current_user
.
check_visibility
(
ub
.
SIDEBAR_SERIES
):
entries
=
db
.
session
.
query
(
db
.
Series
,
func
.
count
(
'books_series_link.book'
)
.
label
(
'count'
))
\
.
join
(
db
.
books_series_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_series_link.series'
)
.
order_by
(
db
.
Series
.
sort
)
.
all
()
.
group_by
(
text
(
'books_series_link.series'
)
)
.
order_by
(
db
.
Series
.
sort
)
.
all
()
charlist
=
db
.
session
.
query
(
func
.
upper
(
func
.
substr
(
db
.
Series
.
sort
,
1
,
1
))
.
label
(
'char'
))
\
.
join
(
db
.
books_series_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
func
.
upper
(
func
.
substr
(
db
.
Series
.
sort
,
1
,
1
)))
.
all
()
...
...
@@ -728,6 +719,36 @@ def series(book_id, page):
abort
(
404
)
@
web
.
route
(
"/ratings"
)
@
login_required_if_no_ano
def
ratings_list
():
if
current_user
.
check_visibility
(
ub
.
SIDEBAR_RATING
):
entries
=
db
.
session
.
query
(
db
.
Series
,
func
.
count
(
'books_series_link.book'
)
.
label
(
'count'
))
\
.
join
(
db
.
books_series_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
text
(
'books_series_link.series'
))
.
order_by
(
db
.
Series
.
sort
)
.
all
()
charlist
=
db
.
session
.
query
(
func
.
upper
(
func
.
substr
(
db
.
Series
.
sort
,
1
,
1
))
.
label
(
'char'
))
\
.
join
(
db
.
books_series_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
func
.
upper
(
func
.
substr
(
db
.
Series
.
sort
,
1
,
1
)))
.
all
()
return
render_title_template
(
'list.html'
,
entries
=
entries
,
folder
=
'web.series'
,
charlist
=
charlist
,
title
=
_
(
u"Ratings list"
),
page
=
"ratingslist"
)
else
:
abort
(
404
)
@
web
.
route
(
"/ratings/<int:book_id>/"
,
defaults
=
{
'page'
:
1
})
@
web
.
route
(
"/ratings/<int:book_id>/<int:page>"
)
@
login_required_if_no_ano
def
ratings
(
book_id
,
page
):
name
=
db
.
session
.
query
(
db
.
Series
)
.
filter
(
db
.
Series
.
id
==
book_id
)
.
first
()
if
name
:
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
db
.
Books
.
series
.
any
(
db
.
Series
.
id
==
book_id
),
[
db
.
Books
.
series_index
])
return
render_title_template
(
'index.html'
,
random
=
random
,
pagination
=
pagination
,
entries
=
entries
,
title
=
_
(
u"Ratings:
%(serie)
s"
,
serie
=
name
.
name
),
page
=
"ratings"
)
else
:
abort
(
404
)
@
web
.
route
(
"/language"
)
@
login_required_if_no_ano
def
language_overview
():
...
...
@@ -749,7 +770,7 @@ def language_overview():
languages
[
0
]
.
name
=
_
(
isoLanguages
.
get
(
part3
=
languages
[
0
]
.
lang_code
)
.
name
)
lang_counter
=
db
.
session
.
query
(
db
.
books_languages_link
,
func
.
count
(
'books_languages_link.book'
)
.
label
(
'bookcount'
))
.
group_by
(
'books_languages_link.lang_code'
)
.
all
()
text
(
'books_languages_link.lang_code'
)
)
.
all
()
return
render_title_template
(
'languages.html'
,
languages
=
languages
,
lang_counter
=
lang_counter
,
charlist
=
charlist
,
title
=
_
(
u"Available languages"
),
page
=
"langlist"
)
else
:
...
...
@@ -780,7 +801,7 @@ def category_list():
if
current_user
.
check_visibility
(
ub
.
SIDEBAR_CATEGORY
):
entries
=
db
.
session
.
query
(
db
.
Tags
,
func
.
count
(
'books_tags_link.book'
)
.
label
(
'count'
))
\
.
join
(
db
.
books_tags_link
)
.
join
(
db
.
Books
)
.
order_by
(
db
.
Tags
.
name
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_tags_link.tag'
)
.
all
()
.
group_by
(
text
(
'books_tags_link.tag'
)
)
.
all
()
charlist
=
db
.
session
.
query
(
func
.
upper
(
func
.
substr
(
db
.
Tags
.
name
,
1
,
1
))
.
label
(
'char'
))
\
.
join
(
db
.
books_tags_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
func
.
upper
(
func
.
substr
(
db
.
Tags
.
name
,
1
,
1
)))
.
all
()
...
...
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