this should stop the generation of orphan works

pull/1/head
eric 2012-01-31 10:01:10 -05:00
parent e10e8e2842
commit d79bf7fb6b
1 changed files with 5 additions and 1 deletions

View File

@ -193,7 +193,11 @@ def add_by_googlebooks_id(googlebooks_id, work=None, results=None, isbn=None):
# going off to google can take some time, so we want to make sure this edition has not
# been created in another thread while we were waiting
try:
return models.Identifier.objects.get(type='goog', value=googlebooks_id).edition
e = models.Identifier.objects.get(type='goog', value=googlebooks_id).edition
# whoa nellie, somebody else created an edition while we were working.
if work.new:
work.delete()
return e
except models.Identifier.DoesNotExist:
pass