diff --git a/cps/templates/index.xml b/cps/templates/index.xml
index 99358941..6a73b10e 100644
--- a/cps/templates/index.xml
+++ b/cps/templates/index.xml
@@ -41,13 +41,13 @@
{{url_for('feed_read_books')}}
{{_('Read Books')}}
+{% endif %}
{{_('Unread Books')}}
{{url_for('feed_unread_books')}}
{{_('Unread Books')}}
-{% endif %}
{{_('Authors')}}
diff --git a/cps/templates/layout.html b/cps/templates/layout.html
index ffb9b28b..ff8c71c6 100644
--- a/cps/templates/layout.html
+++ b/cps/templates/layout.html
@@ -128,8 +128,10 @@
{{_('Best rated Books')}}
{%endif%}
{% if g.user.show_read_and_unread() %}
- {{_('Read Books')}}
- {{_('Unread Books')}}
+ {% if not g.user.is_anonymous %}
+ {{_('Read Books')}}
+ {%endif%}
+ {{_('Unread Books')}}
{%endif%}
{% if g.user.show_random_books() %}
{{_('Discover')}}
diff --git a/cps/web.py b/cps/web.py
index c5d20e04..8f6c9046 100755
--- a/cps/web.py
+++ b/cps/web.py
@@ -1757,20 +1757,15 @@ 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:
- db_filter = db.Books.id.in_(readBookIds)
- else:
- db_filter = ~db.Books.id.in_(readBookIds)
-
- entries, random, pagination = fill_indexpage(page, db.Books,
- db_filter, db.Books.timestamp.desc())
+ 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:
+ db_filter = db.Books.id.in_(readBookIds)
else:
- entries = []
- random = False
- pagination = Pagination(page, 1, 0)
+ db_filter = ~db.Books.id.in_(readBookIds)
+
+ entries, random, pagination = fill_indexpage(page, db.Books,
+ db_filter, db.Books.timestamp.desc())
if as_xml:
xml = render_title_template('feed.xml', entries=entries, pagination=pagination)