1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-28 20:39:59 +00:00

added check for anonymous session in read_books, otherwise current_user.id is not defined

This commit is contained in:
unknown 2017-10-01 18:41:19 +02:00
parent d336f9faa6
commit 3c9f8b151d

View File

@ -1713,6 +1713,7 @@ def feed_get_cover(book_id):
def render_read_books(page, are_read, as_xml=False):
if not current_user.is_anonymous():
readBooks = ub.session.query(ub.ReadBook).filter(ub.ReadBook.user_id == int(current_user.id)).filter(ub.ReadBook.is_read == True).all()
readBookIds = [x.book_id for x in readBooks]
if are_read:
@ -1722,6 +1723,11 @@ def render_read_books(page, are_read, as_xml=False):
entries, random, pagination = fill_indexpage(page, db.Books,
db_filter, db.Books.timestamp.desc())
else:
entries = []
random = False
pagination = Pagination(page, 1, 0)
if as_xml:
xml = render_title_template('feed.xml', entries=entries, pagination=pagination)
response = make_response(xml)