Handle case of no metadata fetchers or fetcher returning None result

This commit is contained in:
Kovid Goyal 2010-12-14 20:33:00 -07:00
parent 4c947784ce
commit a1c7d0615c

View File

@ -276,6 +276,7 @@ def result_index(source, result):
return -1
def merge_results(one, two):
if two is not None and one is not None:
for x in two:
idx = result_index(one, x)
if idx < 0:
@ -337,7 +338,7 @@ def search(title=None, author=None, publisher=None, isbn=None, isbndb_key=None,
manager(title, author, publisher, isbn, verbose)
manager.join()
results = list(fetchers[0].results)
results = list(fetchers[0].results) if fetchers else []
for fetcher in fetchers[1:]:
merge_results(results, fetcher.results)