From f3d5a389eb8a510366ea68d6e6e9762ce024248c Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 5 Sep 2023 13:29:49 +0300 Subject: [PATCH] hide warning msgs about pre 1999 wallets --- core/models/wallets.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/core/models/wallets.py b/core/models/wallets.py index e0f4b00..3a05737 100644 --- a/core/models/wallets.py +++ b/core/models/wallets.py @@ -56,9 +56,24 @@ def make_valid_date(date): print(f"! - Failed to understand date, none of our tricks worked {datestr=} ") return None +archaic_wallets = [ + '1984AndysNotebook', + '1984BrownLandscapeNotebook', + '1989LUSS', + '1989surveybook', + '1990Surveybookkh', + '1991surveybook', + '1992-94Surveybookkh', + '1994', + '1995-96kh', + '1996-1999NotKHbook', + '1997-99kh', + '1999', + 'loosepages', + ] class Wallet(models.Model): """We do not keep the JSON values in the database, we query them afresh each time, - but we will change this when we need to do a Django query on e.g. personame + but we may change this if we need to do a Django query on e.g. personame """ fpath = models.CharField(max_length=200) @@ -95,10 +110,11 @@ class Wallet(models.Model): jsonfile = Path(settings.DRAWINGS_DATA, "walletjson") / wyear / wname / "contents.json" if not Path(jsonfile).is_file(): - message = f"! {jsonfile} is not a file {wyear=} {wname=} " - from troggle.core.models.troggle import DataIssue - print(message) - DataIssue.objects.update_or_create(parser="wallets", message=message, url=wurl) + if wname not in archaic_wallets: + message = f"! {jsonfile} is not a file {wyear=} {wname=} " + print(message) + from troggle.core.models.troggle import DataIssue + DataIssue.objects.update_or_create(parser="wallets", message=message, url=wurl) return None else: with open(jsonfile) as json_f: