mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
newdb: Handle databases that have empty author records
Fixes #1218465 [Can not Edit Metadata](https://bugs.launchpad.net/calibre/+bug/1218465)
This commit is contained in:
parent
5b1ba794b1
commit
6d667dbc8f
@ -1299,11 +1299,7 @@ class Cache(object):
|
||||
string. '''
|
||||
table = self.fields['authors'].table
|
||||
result = []
|
||||
try:
|
||||
rmap = {icu_lower(v):k for k, v in table.id_map.iteritems()}
|
||||
except AttributeError:
|
||||
# Somehow, the authors table has some authors that are None. Corrupted db?
|
||||
rmap = {icu_lower(v or ''):k for k, v in table.id_map.iteritems()}
|
||||
rmap = {icu_lower(v):k for k, v in table.id_map.iteritems()}
|
||||
for aut in authors:
|
||||
aid = rmap.get(icu_lower(aut), None)
|
||||
result.append(author_to_author_sort(aut) if aid is None else table.asort_map[aid])
|
||||
|
@ -56,7 +56,7 @@ class Table(object):
|
||||
}.get(metadata['datatype'], None)
|
||||
if name == 'authors':
|
||||
# Legacy
|
||||
self.unserialize = lambda x: x.replace('|', ',') if x else None
|
||||
self.unserialize = lambda x: x.replace('|', ',') if x else ''
|
||||
|
||||
self.link_table = (link_table if link_table else
|
||||
'books_%s_link'%self.metadata['table'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user