Content server: Fix key error in opds feed after using virtual libraries in the main server

Fixes #1222108 [KeyError virt_libs on opds](https://bugs.launchpad.net/calibre/+bug/1222108)
This commit is contained in:
Kovid Goyal 2013-09-07 16:46:41 +05:30
parent 301dc7a70f
commit 233395c0d4

View File

@ -586,7 +586,10 @@ class OPDSServer(object):
(_('Title'), _('Title'), 'Otitle'), (_('Title'), _('Title'), 'Otitle'),
] ]
def getter(x): def getter(x):
return category_meta[x]['name'].lower() try:
return category_meta[x]['name'].lower()
except KeyError:
return x
for category in sorted(categories, key=lambda x: sort_key(getter(x))): for category in sorted(categories, key=lambda x: sort_key(getter(x))):
if len(categories[category]) == 0: if len(categories[category]) == 0:
continue continue