mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04: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
@ -452,8 +452,11 @@ class ManyToOneField(Field):
|
||||
|
||||
@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 @@ class ManyToManyField(Field):
|
||||
|
||||
@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…
x
Reference in New Issue
Block a user