same optimization in librarything loader
parent
68d6ef93fd
commit
a931b9d2b3
|
@ -211,14 +211,16 @@ def load_librarything_into_wishlist(user, lt_username, max_books=None):
|
|||
logger.info("%d %s %s", i, book["title"]["title"], isbn)
|
||||
try:
|
||||
edition = bookloader.add_by_isbn(isbn)
|
||||
if not edition:
|
||||
continue
|
||||
# add the librarything ids to the db since we know them now
|
||||
edition.librarything_id = book['book_id']
|
||||
edition.save()
|
||||
edition.work.librarything_id = book['work_id']
|
||||
edition.work.save()
|
||||
|
||||
regluit.core.tasks.populate_edition.delay(edition)
|
||||
user.wishlist.add_work(edition.work, 'librarything')
|
||||
if edition.new:
|
||||
regluit.core.tasks.populate_edition.delay(edition)
|
||||
logger.info("Work with isbn %s added to wishlist.", isbn)
|
||||
except Exception, e:
|
||||
logger.info ("error adding ISBN %s: %s", isbn, e)
|
||||
|
|
Loading…
Reference in New Issue