Content server: Respect the restriction when picking a random book

This commit is contained in:
Kovid Goyal 2013-01-16 10:51:55 +05:30
parent 76582f2fe3
commit f5094c211e

View File

@ -894,7 +894,8 @@ class BrowseServer(object):
@Endpoint() @Endpoint()
def browse_random(self, *args, **kwargs): def browse_random(self, *args, **kwargs):
import random 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) ans = self.browse_render_details(book_id)
return self.browse_template('').format( return self.browse_template('').format(
title='', script='book();', main=ans) title='', script='book();', main=ans)