This commit is contained in:
Kovid Goyal 2013-07-12 17:38:16 +05:30
parent a8033fc610
commit 7c1421d15a
2 changed files with 5 additions and 4 deletions

View File

@ -315,8 +315,7 @@ class LibraryDatabase(object):
def authors_sort_strings(self, index, index_is_id=False): def authors_sort_strings(self, index, index_is_id=False):
book_id = index if index_is_id else self.data.index_to_id(index) book_id = index if index_is_id else self.data.index_to_id(index)
with self.new_api.read_lock: with self.new_api.read_lock:
af = self.new_api.fields['authors'].table authors = self.new_api._field_ids_for('authors', book_id)
authors = af.book_col_map.get(book_id, ())
adata = self.new_api._author_data(authors) adata = self.new_api._author_data(authors)
return [adata[aid]['sort'] for aid in authors] return [adata[aid]['sort'] for aid in authors]
@ -326,8 +325,7 @@ class LibraryDatabase(object):
def authors_with_sort_strings(self, index, index_is_id=False): def authors_with_sort_strings(self, index, index_is_id=False):
book_id = index if index_is_id else self.data.index_to_id(index) book_id = index if index_is_id else self.data.index_to_id(index)
with self.new_api.read_lock: with self.new_api.read_lock:
af = self.new_api.fields['authors'].table authors = self.new_api._field_ids_for('authors', book_id)
authors = af.book_col_map.get(book_id, ())
adata = self.new_api._author_data(authors) adata = self.new_api._author_data(authors)
return [(aid, adata[aid]['name'], adata[aid]['sort'], adata[aid]['link']) for aid in authors] return [(aid, adata[aid]['name'], adata[aid]['sort'], adata[aid]['link']) for aid in authors]

View File

@ -262,6 +262,8 @@ class LegacyTest(BaseTest):
'get_feeds', 'get_feed', 'update_feed', 'remove_feeds', 'add_feed', 'set_feeds', 'get_feeds', 'get_feed', 'update_feed', 'remove_feeds', 'add_feed', 'set_feeds',
# Obsolete/broken methods # Obsolete/broken methods
'author_id', # replaced by get_author_id 'author_id', # replaced by get_author_id
'books_for_author', # broken
'books_in_old_database', # unused
} }
SKIP_ARGSPEC = { SKIP_ARGSPEC = {
'__init__', 'get_next_series_num_for', 'has_book', 'author_sort_from_authors', '__init__', 'get_next_series_num_for', 'has_book', 'author_sort_from_authors',
@ -329,3 +331,4 @@ class LegacyTest(BaseTest):
T(('n', object())) T(('n', object()))
old.close() old.close()
# }}} # }}}