Nicer error message when virtual library has no books

Fixes #1220030 [Content Server No Books Error](https://bugs.launchpad.net/calibre/+bug/1220030)
This commit is contained in:
Kovid Goyal 2013-09-03 11:06:20 +05:30
parent 2023fb01d0
commit 28b104d10d

View File

@ -675,6 +675,16 @@ class BrowseServer(object):
which = unhexlify(cid).decode('utf-8')
vls = self.db.prefs.get('virtual_libraries', {})
ids = self.search_cache(vls[which])
if not ids:
msg = _('The virtual library <b>%s</b> has no books.') % prepare_string_for_xml(which)
if self.search_restriction:
msg += ' ' + _(
'This is probably because you have applied a virtual library'
' to the content server in Preferences->Sharing over the net.'
' This virtual library is applied globally and combined with'
' the current virtual library.')
return self.browse_template('name').format(title='',
script='', main='<p>%s</p>'%msg)
else:
if fm.get(category, {'datatype':None})['datatype'] == 'composite':
cid = cid.decode('utf-8')