Content server: Popup a more useful error when clicking on the cover of a book that has no formats to view. Fixes #1260216 [Web content server error: 404 Not Found (The path '/browse/category/' was not found.)](https://bugs.launchpad.net/calibre/+bug/1260216)

This commit is contained in:
Kovid Goyal 2013-12-12 14:58:25 +05:30
parent 0fcdd09d21
commit 7b1a1eb804

View File

@ -814,7 +814,9 @@ class BrowseServer(object):
(xml(href, True), rt, xml(_('Get'))) (xml(href, True), rt, xml(_('Get')))
args['get_url'] = xml(href, True) args['get_url'] = xml(href, True)
else: else:
args['get_button'] = args['get_url'] = '' args['get_button'] = ''
args['get_url'] = 'javascript:alert(\'%s\')' % xml(_(
'This book has no available formats to view'), True)
args['comments'] = comments_to_html(mi.comments) args['comments'] = comments_to_html(mi.comments)
args['stars'] = '' args['stars'] = ''
if mi.rating: if mi.rating:
@ -848,7 +850,8 @@ class BrowseServer(object):
args['get_url'] = xml(self.opts.url_prefix + '/get/%s/%s_%d.%s'%( args['get_url'] = xml(self.opts.url_prefix + '/get/%s/%s_%d.%s'%(
fmt, fname, id_, fmt), True) fmt, fname, id_, fmt), True)
else: else:
args['get_url'] = '' args['get_url'] = 'javascript:alert(\'%s\')' % xml(_(
'This book has no available formats to view'), True)
args['formats'] = '' args['formats'] = ''
if fmts: if fmts:
ofmts = [u'<a href="{4}/get/{0}/{1}_{2}.{0}" title="{3}">{3}</a>' ofmts = [u'<a href="{4}/get/{0}/{1}_{2}.{0}" title="{3}">{3}</a>'