mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-25 21:43:11 +02:00
newdb: Handle databases with invalid ratings link tables
Fixes #1228517 [crashes on change library](https://bugs.launchpad.net/calibre/+bug/1228517)
This commit is contained in:
parent
50beda31ae
commit
3e522c4e15
1 changed files with 8 additions and 2 deletions
|
|
@ -452,8 +452,11 @@ def iter_searchable_values(self, get_metadata, candidates, default_value=None):
|
|||
|
||||
@property
|
||||
def book_value_map(self):
|
||||
return {book_id:self.table.id_map[item_id] for book_id, item_id in
|
||||
try:
|
||||
return {book_id:self.table.id_map[item_id] for book_id, item_id in
|
||||
self.table.book_col_map.iteritems()}
|
||||
except KeyError:
|
||||
raise InvalidLinkTable(self.name)
|
||||
|
||||
class ManyToManyField(Field):
|
||||
|
||||
|
|
@ -514,8 +517,11 @@ def iter_counts(self, candidates):
|
|||
|
||||
@property
|
||||
def book_value_map(self):
|
||||
return {book_id:tuple(self.table.id_map[item_id] for item_id in item_ids)
|
||||
try:
|
||||
return {book_id:tuple(self.table.id_map[item_id] for item_id in item_ids)
|
||||
for book_id, item_ids in self.table.book_col_map.iteritems()}
|
||||
except KeyError:
|
||||
raise InvalidLinkTable(self.name)
|
||||
|
||||
class IdentifiersField(ManyToManyField):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue