mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
Fixes error state when there are author duplicates
there shouldn't be, but it shouldn't crash a goodreads import either
This commit is contained in:
parent
ffeed6047e
commit
0a2d762d3b
1 changed files with 3 additions and 4 deletions
|
@ -177,10 +177,9 @@ class Connector(AbstractConnector):
|
|||
''' load that author '''
|
||||
if not re.match(r'^OL\d+A$', olkey):
|
||||
raise ValueError('Invalid OpenLibrary author ID')
|
||||
try:
|
||||
return models.Author.objects.get(openlibrary_key=olkey)
|
||||
except models.Author.DoesNotExist:
|
||||
pass
|
||||
author = models.Author.objects.filter(openlibrary_key=olkey).first()
|
||||
if author:
|
||||
return author
|
||||
|
||||
url = '%s/authors/%s.json' % (self.base_url, olkey)
|
||||
data = get_data(url)
|
||||
|
|
Loading…
Reference in a new issue