From 996b17bae8a20861bcbcbe5924820fdd691d0d3d Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 23 Feb 2012 18:51:29 -0500 Subject: [PATCH] fixed bug where edition.public_domain never gets set --- core/bookloader.py | 2 +- core/tests.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/bookloader.py b/core/bookloader.py index 5a1a98fe..fb2df2a4 100755 --- a/core/bookloader.py +++ b/core/bookloader.py @@ -107,7 +107,7 @@ def get_google_isbn_results(isbn): def add_ebooks(item, edition): access_info = item.get('accessInfo') if access_info: - edition.public_domain = item.get('public_domain', None) + edition.public_domain = access_info.get('publicDomain', None) epub = access_info.get('epub') if epub and epub.get('downloadLink'): ebook = models.Ebook(edition=edition, format='epub', diff --git a/core/tests.py b/core/tests.py index 6461e291..e66e9c89 100755 --- a/core/tests.py +++ b/core/tests.py @@ -234,6 +234,7 @@ class BookLoaderTests(TestCase): self.assertEqual(parse_qs(urlparse(ebook_pdf.url).query).get("id"), ['U3FXAAAAYAAJ']) self.assertEqual(parse_qs(urlparse(ebook_pdf.url).query).get("output"), ['pdf']) self.assertEqual(ebook_pdf.provider, 'google') + self.assertEqual(edition.public_domain, True) w = edition.work self.assertEqual(w.first_epub().url, ebook_epub.url)