From f5094c211ec3327e3c6996d6b237d31533f510bb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Jan 2013 10:51:55 +0530 Subject: [PATCH] Content server: Respect the restriction when picking a random book --- src/calibre/library/server/browse.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/library/server/browse.py b/src/calibre/library/server/browse.py index e315bb6f3e..0f4878b06c 100644 --- a/src/calibre/library/server/browse.py +++ b/src/calibre/library/server/browse.py @@ -894,7 +894,8 @@ class BrowseServer(object): @Endpoint() def browse_random(self, *args, **kwargs): import random - book_id = random.choice(tuple(self.db.all_ids())) + book_id = random.choice(self.db.search_getting_ids( + '', self.search_restriction)) ans = self.browse_render_details(book_id) return self.browse_template('').format( title='', script='book();', main=ans)