Content server: Apply the search restriction when generating category lists as well

This commit is contained in:
Kovid Goyal 2010-10-10 17:59:48 -06:00
parent 82305c2b1b
commit 9d27ff0ef3
2 changed files with 3 additions and 0 deletions

View File

@ -26,6 +26,7 @@ class BrowseServer(object):
connect('browse_json', base_href+'/json/{query}', self.browse_json)
def browse_template(self, category=True):
def generate():
if category:
sort_opts = [('rating', _('Average rating')), ('name',

View File

@ -29,6 +29,8 @@ class Cache(object):
def categories_cache(self, restrict_to=frozenset([])):
base_restriction = self.search_cache('')
restrict_to = frozenset(restrict_to).intersection(base_restriction)
old = self._category_cache.pop(frozenset(restrict_to), None)
if old is None or old[0] <= self.db.last_modified():
categories = self.db.get_categories(ids=restrict_to)