fixed bug where edition.public_domain never gets set

pull/1/head
eric 2012-02-23 18:51:29 -05:00 committed by Raymond Yee
parent 7b9d8e5c6c
commit 996b17bae8
2 changed files with 2 additions and 1 deletions

View File

@ -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',

View File

@ -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)