Fixes isbn assignment for goodreads

This commit is contained in:
Mouse Reeve
2021-11-13 12:24:16 -08:00
parent a9622942cd
commit fb91c33682
4 changed files with 21 additions and 19 deletions

View File

@ -12,6 +12,8 @@ from .fields import PrivacyLevels
def unquote_string(text):
"""resolve csv quote weirdness"""
if not text:
return None
match = re.match(r'="([^"]*)"', text)
if match:
return match.group(1)
@ -122,7 +124,7 @@ class ImportItem(models.Model):
@property
def isbn(self):
"""pulls out the isbn13 field from the csv line data"""
return unquote_string(self.normalized_data["isbn_13"])
return unquote_string(self.normalized_data["isbn_13"]) or unquote_string(self.normalized_data["isbn_10"])
@property
def shelf(self):