turns out some records in googlebooks have no title!

https://www.googleapis.com/books/v1/volumes/?q=isbn:9780867130768
pull/1/head
eric 2012-02-02 11:33:51 -05:00
parent f9de2d229f
commit 6215a7c8d8
1 changed files with 8 additions and 2 deletions

View File

@ -138,7 +138,10 @@ def update_edition(edition):
item=results['items'][0]
googlebooks_id=item['id']
d = item['volumeInfo']
title = d['title']
if d.has_key('title'):
title = d['title']
else:
title=''
if len(title)==0:
# need a title to make an edition record; some crap records in GB. use title from parent if available
title=edition.work.title
@ -249,7 +252,10 @@ def add_by_googlebooks_id(googlebooks_id, work=None, results=None, isbn=None):
item = _get_json(url)
d = item['volumeInfo']
title = d['title']
if d.has_key('title'):
title = d['title']
else:
title=''
if len(title)==0:
# need a title to make an edition record; some crap records in GB. use title from parent if available
if work: