mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix #751950: make content server ignore non-existent search restrictions.
This commit is contained in:
parent
97c5b041a3
commit
086a295917
@ -24,6 +24,8 @@ from calibre.library.server.xml import XMLServer
|
|||||||
from calibre.library.server.opds import OPDSServer
|
from calibre.library.server.opds import OPDSServer
|
||||||
from calibre.library.server.cache import Cache
|
from calibre.library.server.cache import Cache
|
||||||
from calibre.library.server.browse import BrowseServer
|
from calibre.library.server.browse import BrowseServer
|
||||||
|
from calibre.utils.search_query_parser import saved_searches
|
||||||
|
from calibre import prints
|
||||||
|
|
||||||
|
|
||||||
class DispatchController(object): # {{{
|
class DispatchController(object): # {{{
|
||||||
@ -178,7 +180,12 @@ class LibraryServer(ContentServer, MobileServer, XMLServer, OPDSServer, Cache,
|
|||||||
def set_search_restriction(self, restriction):
|
def set_search_restriction(self, restriction):
|
||||||
self.search_restriction_name = restriction
|
self.search_restriction_name = restriction
|
||||||
if restriction:
|
if restriction:
|
||||||
self.search_restriction = 'search:"%s"'%restriction
|
if restriction not in saved_searches().names():
|
||||||
|
prints('WARNING: Content server: search restriction ',
|
||||||
|
restriction, ' does not exist')
|
||||||
|
self.search_restriction = ''
|
||||||
|
else:
|
||||||
|
self.search_restriction = 'search:"%s"'%restriction
|
||||||
else:
|
else:
|
||||||
self.search_restriction = ''
|
self.search_restriction = ''
|
||||||
self.reset_caches()
|
self.reset_caches()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user