diff --git a/api/views.py b/api/views.py index 8267359c..f151ae75 100755 --- a/api/views.py +++ b/api/views.py @@ -53,7 +53,7 @@ def widget(request,isbn): work = identifier.work edition = identifier.edition campaigns = work.campaigns.all() - except models.Identifer.DoesNotExist: + except models.Identifier.DoesNotExist: edition = None work = None campaigns = [] diff --git a/core/bookloader.py b/core/bookloader.py index 9b3330cf..fbea04a5 100755 --- a/core/bookloader.py +++ b/core/bookloader.py @@ -524,7 +524,7 @@ def load_gutenberg_edition(title, gutenberg_etext_id, ol_work_id, seed_isbn, url sister_edition = add_by_isbn(seed_isbn) if sister_edition.new: # add related editions asynchronously - regluit.core.tasks.populate_edition.delay(sister_edition) + regluit.core.tasks.populate_edition.delay(sister_edition.isbn_13) work = sister_edition.work # attach the olwk identifier to this work if it's not none. if ol_work_id is not None: diff --git a/core/goodreads.py b/core/goodreads.py index 2229f090..f1a24ff1 100644 --- a/core/goodreads.py +++ b/core/goodreads.py @@ -293,7 +293,7 @@ def load_goodreads_shelf_into_wishlist(user, shelf_name='all', goodreads_user_id else: logger.error("unable to extract goodreads id from %s", link) if edition.new: - regluit.core.tasks.populate_edition.delay(edition) + regluit.core.tasks.populate_edition.delay(edition.isbn_13) except Exception, e: logger.info ("Exception adding ISBN %s: %s", isbn, e) diff --git a/core/librarything.py b/core/librarything.py index d22041f1..f1dca5a2 100644 --- a/core/librarything.py +++ b/core/librarything.py @@ -230,7 +230,7 @@ def load_librarything_into_wishlist(user, lt_username, max_books=None): identifier= models.Identifier.get_or_add(type = 'lccn', value = book['lc_call_number'], edition = edition, work = edition.work) user.wishlist.add_work(edition.work, 'librarything') if edition.new: - tasks.populate_edition.delay(edition) + tasks.populate_edition.delay(edition.isbn_13) logger.info("Work with isbn %s added to wishlist.", isbn) except Exception, e: logger.info ("error adding ISBN %s: %s", isbn, e) diff --git a/core/management/commands/goodreads_load_books.py b/core/management/commands/goodreads_load_books.py index e0c5c5ec..ce818baf 100644 --- a/core/management/commands/goodreads_load_books.py +++ b/core/management/commands/goodreads_load_books.py @@ -16,4 +16,4 @@ class Command(BaseCommand): user = User.objects.get(username=user_name) max_books = int(max_books) - tasks.load_goodreads_shelf_into_wishlist.delay(user, shelf_name, goodreads_user_id, max_books) \ No newline at end of file + tasks.load_goodreads_shelf_into_wishlist.delay(user.id, shelf_name, goodreads_user_id, max_books) \ No newline at end of file diff --git a/core/management/commands/librarything_load_books.py b/core/management/commands/librarything_load_books.py index 6702879f..8c6d4590 100644 --- a/core/management/commands/librarything_load_books.py +++ b/core/management/commands/librarything_load_books.py @@ -13,4 +13,4 @@ class Command(BaseCommand): user = User.objects.get(username=user_name) max_books = int(max_books) - tasks.load_librarything_into_wishlist.delay(user, lt_username, max_books) \ No newline at end of file + tasks.load_librarything_into_wishlist.delay(user.id, lt_username, max_books) \ No newline at end of file diff --git a/core/tasks.py b/core/tasks.py index d74420e6..e42678bb 100644 --- a/core/tasks.py +++ b/core/tasks.py @@ -2,25 +2,31 @@ from time import sleep from celery.decorators import task -from regluit.core import bookloader +from django.contrib.auth.models import User + +from regluit.core import bookloader, models from regluit.core import goodreads, librarything @task -def populate_edition(edition): +def populate_edition(isbn): """given an edition this task will populate the database with additional information about related editions and subjects related to this edition """ - bookloader.add_related(edition.isbn_13) - bookloader.add_openlibrary(edition.work) + bookloader.add_related(isbn) + edition=models.Edition.get_by_isbn(isbn) + if edition: + bookloader.add_openlibrary(edition.work) return edition @task -def load_goodreads_shelf_into_wishlist(user, shelf_name='all', goodreads_user_id=None, max_books=None, +def load_goodreads_shelf_into_wishlist(user_id, shelf_name='all', goodreads_user_id=None, max_books=None, expected_number_of_books=None): + user=User.objects.get(id=user_id) return goodreads.load_goodreads_shelf_into_wishlist(user,shelf_name,goodreads_user_id,max_books, expected_number_of_books) - + @task -def load_librarything_into_wishlist(user, lt_username, max_books=None): +def load_librarything_into_wishlist(user_id, lt_username, max_books=None): + user=User.objects.get(id=user_id) return librarything.load_librarything_into_wishlist(user, lt_username, max_books) @task diff --git a/core/tests.py b/core/tests.py index 1288fe7a..9d8c0768 100755 --- a/core/tests.py +++ b/core/tests.py @@ -90,7 +90,7 @@ class BookLoaderTests(TestCase): def test_populate_edition(self): edition = bookloader.add_by_googlebooks_id('c_dBPgAACAAJ') - edition = tasks.populate_edition.run(edition) + edition = tasks.populate_edition.run(edition.isbn_13) self.assertTrue(edition.work.editions.all().count() > 20) self.assertTrue(edition.work.subjects.all().count() > 10) self.assertTrue(edition.work.publication_date) diff --git a/experimental/zotero_books.py b/experimental/zotero_books.py index e311695b..fa387090 100644 --- a/experimental/zotero_books.py +++ b/experimental/zotero_books.py @@ -101,7 +101,7 @@ class MyZotero(Zotero2): if isbn: edition = bookloader.add_by_isbn(isbn) # let's not trigger too much traffic to Google books for now - regluit.core.tasks.populate_edition.delay(edition) + regluit.core.tasks.populate_edition.delay(edition.isbn_13) user.wishlist.add_work(edition.work, 'zotero') logger.info("Work with isbn %s added to wishlist.", isbn) except Exception, e: diff --git a/frontend/templates/faq.html b/frontend/templates/faq.html index cb40face..8bf26f00 100644 --- a/frontend/templates/faq.html +++ b/frontend/templates/faq.html @@ -19,7 +19,9 @@
What is Crowdfunding?
-
Crowdfunding is working together to support something you believe in. By pooling donations, big and small, from all over the world, we can make huge things happen.
+
Crowdfunding is collectively pooling donations (or pledges) to support some cause. Using the internet to coordinate means that complete strangers can work together, drawn by a common cause. This also means the number of donors can be vast, so individual donations can be as large or as small as people are comfortable with, and still add up to enough to do something amazing.

+Want to see some examples? The Buy India a Library project (cofounded by an Unglue.It team member) crowdfunded donations -- mostly small ones, around $20 -- to build a school library in India. Kickstarter lets artists and inventors solicit funds to make their projects a reality. For instance, webcomic artist Rich Burlew sought $57,750 to reprint his comics in paper form -- and raised close to a million.

+In other words, crowdfunding working together to support something you love. By pooling donations, big and small, from all over the world, we can make huge things happen.
What does it cost?
diff --git a/frontend/views.py b/frontend/views.py index 9a71df7a..9371ed7e 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -177,7 +177,7 @@ def googlebooks(request, googlebooks_id): edition = bookloader.add_by_googlebooks_id(googlebooks_id) if edition.new: # add related editions asynchronously - tasks.populate_edition.delay(edition) + tasks.populate_edition.delay(edition.isbn_13) except bookloader.LookupFailure: logger.warning("failed to load googlebooks_id %s" % googlebooks_id) return HttpResponseNotFound("failed looking up googlebooks id %s" % googlebooks_id) @@ -863,7 +863,7 @@ def wishlist(request): edition = bookloader.add_by_googlebooks_id(googlebooks_id) if edition.new: # add related editions asynchronously - tasks.populate_edition.delay(edition) + tasks.populate_edition.delay(edition.isbn_13) request.user.wishlist.add_work(edition.work,'user') except bookloader.LookupFailure: logger.warning("failed to load googlebooks_id %s" % googlebooks_id) @@ -1066,7 +1066,7 @@ def goodreads_load_shelf(request): logger.info('Adding task to load shelf %s to user %s with %d books', shelf_name, user, expected_number_of_books) load_task_name = "load_goodreads_shelf_into_wishlist" load_task = getattr(tasks, load_task_name) - task_id = load_task.delay(user, shelf_name, expected_number_of_books=expected_number_of_books) + task_id = load_task.delay(user.id, shelf_name, expected_number_of_books=expected_number_of_books) ct = models.CeleryTask() ct.task_id = task_id @@ -1119,7 +1119,7 @@ def librarything_load(request): logger.info('Adding task to load librarything %s to user %s', lt_username, user ) load_task_name = "load_librarything_into_wishlist" load_task = getattr(tasks, load_task_name) - task_id = load_task.delay(user, lt_username, None) + task_id = load_task.delay(user.id, lt_username, None) ct = models.CeleryTask() ct.task_id = task_id diff --git a/test/booktests.py b/test/booktests.py index 2fa98673..f53aad0d 100644 --- a/test/booktests.py +++ b/test/booktests.py @@ -49,7 +49,7 @@ def load_penguin_moby_dick(): seed_isbn = '9780142000083' ed = bookloader.add_by_isbn(seed_isbn) if ed.new: - ed = tasks.populate_edition.delay(ed) + ed = tasks.populate_edition.delay(ed.isbn_13) def load_gutenberg_moby_dick(): title = "Moby Dick"