fixed bug where edition.public_domain never gets set
parent
7b9d8e5c6c
commit
996b17bae8
|
@ -107,7 +107,7 @@ def get_google_isbn_results(isbn):
|
||||||
def add_ebooks(item, edition):
|
def add_ebooks(item, edition):
|
||||||
access_info = item.get('accessInfo')
|
access_info = item.get('accessInfo')
|
||||||
if access_info:
|
if access_info:
|
||||||
edition.public_domain = item.get('public_domain', None)
|
edition.public_domain = access_info.get('publicDomain', None)
|
||||||
epub = access_info.get('epub')
|
epub = access_info.get('epub')
|
||||||
if epub and epub.get('downloadLink'):
|
if epub and epub.get('downloadLink'):
|
||||||
ebook = models.Ebook(edition=edition, format='epub',
|
ebook = models.Ebook(edition=edition, format='epub',
|
||||||
|
|
|
@ -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("id"), ['U3FXAAAAYAAJ'])
|
||||||
self.assertEqual(parse_qs(urlparse(ebook_pdf.url).query).get("output"), ['pdf'])
|
self.assertEqual(parse_qs(urlparse(ebook_pdf.url).query).get("output"), ['pdf'])
|
||||||
self.assertEqual(ebook_pdf.provider, 'google')
|
self.assertEqual(ebook_pdf.provider, 'google')
|
||||||
|
self.assertEqual(edition.public_domain, True)
|
||||||
|
|
||||||
w = edition.work
|
w = edition.work
|
||||||
self.assertEqual(w.first_epub().url, ebook_epub.url)
|
self.assertEqual(w.first_epub().url, ebook_epub.url)
|
||||||
|
|
Loading…
Reference in New Issue