From 7c1421d15a6137a4a5fa90ec060d1ebec6e1433f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 12 Jul 2013 17:38:16 +0530 Subject: [PATCH] ... --- src/calibre/db/legacy.py | 6 ++---- src/calibre/db/tests/legacy.py | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/calibre/db/legacy.py b/src/calibre/db/legacy.py index 0ab29d2e3d..ff0c742e9d 100644 --- a/src/calibre/db/legacy.py +++ b/src/calibre/db/legacy.py @@ -315,8 +315,7 @@ class LibraryDatabase(object): def authors_sort_strings(self, index, index_is_id=False): book_id = index if index_is_id else self.data.index_to_id(index) with self.new_api.read_lock: - af = self.new_api.fields['authors'].table - authors = af.book_col_map.get(book_id, ()) + authors = self.new_api._field_ids_for('authors', book_id) adata = self.new_api._author_data(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): book_id = index if index_is_id else self.data.index_to_id(index) with self.new_api.read_lock: - af = self.new_api.fields['authors'].table - authors = af.book_col_map.get(book_id, ()) + authors = self.new_api._field_ids_for('authors', book_id) adata = self.new_api._author_data(authors) return [(aid, adata[aid]['name'], adata[aid]['sort'], adata[aid]['link']) for aid in authors] diff --git a/src/calibre/db/tests/legacy.py b/src/calibre/db/tests/legacy.py index fa76439387..daa53b7ddd 100644 --- a/src/calibre/db/tests/legacy.py +++ b/src/calibre/db/tests/legacy.py @@ -262,6 +262,8 @@ class LegacyTest(BaseTest): 'get_feeds', 'get_feed', 'update_feed', 'remove_feeds', 'add_feed', 'set_feeds', # Obsolete/broken methods 'author_id', # replaced by get_author_id + 'books_for_author', # broken + 'books_in_old_database', # unused } SKIP_ARGSPEC = { '__init__', 'get_next_series_num_for', 'has_book', 'author_sort_from_authors', @@ -329,3 +331,4 @@ class LegacyTest(BaseTest): T(('n', object())) old.close() # }}} +