Fix opds login on python3

This commit is contained in:
Ozzieisaacs
2019-03-03 07:37:15 +01:00
parent de58d0a4d8
commit 68a36597ab
6 changed files with 104 additions and 16 deletions
+6 -2
View File
@@ -141,7 +141,7 @@ def load_user_from_header(header_val):
header_val = header_val.replace('Basic ', '', 1)
basic_username = basic_password = ''
try:
header_val = base64.b64decode(header_val)
header_val = base64.b64decode(header_val).decode('utf-8')
basic_username = header_val.split(':')[0]
basic_password = header_val.split(':')[1]
except TypeError:
@@ -598,9 +598,13 @@ def author_list():
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()
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()
# charlist = db.session.query(func.substr(db.Authors.sort,1,1).label('char'),func.count(db.Authors.sort).label('count')).group_by(func.substr(db.Authors.sort,1,1)).all()
for entry in entries:
entry.Authors.name = entry.Authors.name.replace('|', ',')
return render_title_template('list.html', entries=entries, folder='web.author',
return render_title_template('list.html', entries=entries, folder='web.author', charlist=charlist,
title=u"Author list", page="authorlist")
else:
abort(404)