mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Content server: Apply the search restriction when generating category lists as well
This commit is contained in:
parent
82305c2b1b
commit
9d27ff0ef3
@ -26,6 +26,7 @@ class BrowseServer(object):
|
|||||||
connect('browse_json', base_href+'/json/{query}', self.browse_json)
|
connect('browse_json', base_href+'/json/{query}', self.browse_json)
|
||||||
|
|
||||||
def browse_template(self, category=True):
|
def browse_template(self, category=True):
|
||||||
|
|
||||||
def generate():
|
def generate():
|
||||||
if category:
|
if category:
|
||||||
sort_opts = [('rating', _('Average rating')), ('name',
|
sort_opts = [('rating', _('Average rating')), ('name',
|
||||||
|
@ -29,6 +29,8 @@ class Cache(object):
|
|||||||
|
|
||||||
|
|
||||||
def categories_cache(self, restrict_to=frozenset([])):
|
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)
|
old = self._category_cache.pop(frozenset(restrict_to), None)
|
||||||
if old is None or old[0] <= self.db.last_modified():
|
if old is None or old[0] <= self.db.last_modified():
|
||||||
categories = self.db.get_categories(ids=restrict_to)
|
categories = self.db.get_categories(ids=restrict_to)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user