From 02c7397eaf87903435f465191d43d7703a7ad07b Mon Sep 17 00:00:00 2001 From: Hunter Chambers Date: Sun, 9 Oct 2022 19:36:24 -0400 Subject: [PATCH 1/2] Closes #2194 Normalize stored ISNI --- bookwyrm/models/author.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bookwyrm/models/author.py b/bookwyrm/models/author.py index 78d153a21..348754042 100644 --- a/bookwyrm/models/author.py +++ b/bookwyrm/models/author.py @@ -42,6 +42,11 @@ class Author(BookDataModel): for book in self.book_set.values_list("id", flat=True) ] cache.delete_many(cache_keys) + + # normalize isni format + if self.isni: + self.isni = re.sub(r"\s", "", self.isni) + return super().save(*args, **kwargs) @property From 32f68c3f62b4808371f658d3491b23a388e6f83e Mon Sep 17 00:00:00 2001 From: Hunter Chambers Date: Mon, 10 Oct 2022 14:13:57 -0400 Subject: [PATCH 2/2] remove trailing whitespace causing pylint/black errors --- bookwyrm/models/author.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/models/author.py b/bookwyrm/models/author.py index 348754042..7d2a0e62b 100644 --- a/bookwyrm/models/author.py +++ b/bookwyrm/models/author.py @@ -42,7 +42,7 @@ class Author(BookDataModel): for book in self.book_set.values_list("id", flat=True) ] cache.delete_many(cache_keys) - + # normalize isni format if self.isni: self.isni = re.sub(r"\s", "", self.isni)