diff --git a/cps/search.py b/cps/search.py index 096b2928..4eee2206 100644 --- a/cps/search.py +++ b/cps/search.py @@ -375,13 +375,19 @@ def render_prepare_search_form(cc): def render_search_results(term, offset=None, order=None, limit=None): - join = db.books_series_link, db.Books.id == db.books_series_link.c.book, db.Series - entries, result_count, pagination = calibre_db.get_search_results(term, - config, - offset, - order, - limit, - *join) + if term: + join = db.books_series_link, db.Books.id == db.books_series_link.c.book, db.Series + entries, result_count, pagination = calibre_db.get_search_results(term, + config, + offset, + order, + limit, + *join) + else: + entries = list() + order = [None, None] + pagination = result_count = None + return render_title_template('search.html', searchterm=term, pagination=pagination, diff --git a/cps/web.py b/cps/web.py index 789edd3d..51ff32b3 100755 --- a/cps/web.py +++ b/cps/web.py @@ -396,7 +396,7 @@ def render_books_list(data, sort_param, book_id, page): elif data == "archived": return render_archived_books(page, order) elif data == "search": - term = (request.args.get('query') or '') + term = request.args.get('query', None) offset = int(int(config.config_books_per_page) * (page - 1)) return render_search_results(term, offset, order, config.config_books_per_page) elif data == "advsearch":