From 233395c0d4ff037c11064e627f3249b9e1698fe0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 7 Sep 2013 16:46:41 +0530 Subject: [PATCH] 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) --- src/calibre/library/server/opds.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/library/server/opds.py b/src/calibre/library/server/opds.py index b4e5c7b265..56e0067abc 100644 --- a/src/calibre/library/server/opds.py +++ b/src/calibre/library/server/opds.py @@ -586,7 +586,10 @@ class OPDSServer(object): (_('Title'), _('Title'), 'Otitle'), ] 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))): if len(categories[category]) == 0: continue