only add to wishlist if an edition was found

pull/1/head
Ed Summers 2012-01-17 09:46:12 -05:00
parent 245fefe1f1
commit 285be53900
1 changed files with 2 additions and 5 deletions

View File

@ -14,11 +14,8 @@ class Command(BaseCommand):
isbn = isbn.strip()
edition = bookloader.add_by_isbn(isbn)
bookloader.add_related(isbn)
user.wishlist.add_work(edition.work, source="user")
if edition:
print "loaded %s as %s" % (isbn, edition)
user.wishlist.add_work(edition.work, source="user")
print "loaded %s as %s for %s" % (isbn, edition, user)
else:
print "failed to load book for %s" % isbn