From 28b104d10df803d4df256fedf5ec6374709ae75e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 3 Sep 2013 11:06:20 +0530 Subject: [PATCH] Nicer error message when virtual library has no books Fixes #1220030 [Content Server No Books Error](https://bugs.launchpad.net/calibre/+bug/1220030) --- src/calibre/library/server/browse.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/calibre/library/server/browse.py b/src/calibre/library/server/browse.py index 5e98d70c27..b489ed58db 100644 --- a/src/calibre/library/server/browse.py +++ b/src/calibre/library/server/browse.py @@ -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 %s 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='

%s

'%msg) else: if fm.get(category, {'datatype':None})['datatype'] == 'composite': cid = cid.decode('utf-8')