stop crash on live system

This commit is contained in:
Philip Sargent 2023-07-14 11:21:49 +02:00
parent 387bdf4f91
commit 4e4824546a

View File

@ -53,6 +53,7 @@ class Wallet(models.Model):
jsonfile = Path(settings.DRAWINGS_DATA, "walletjson") / wyear / wname / "contents.json" jsonfile = Path(settings.DRAWINGS_DATA, "walletjson") / wyear / wname / "contents.json"
if not Path(jsonfile).is_file(): if not Path(jsonfile).is_file():
print(f'{jsonfile} is not a file {wyear=} {wname=} ') print(f'{jsonfile} is not a file {wyear=} {wname=} ')
# Should this be a DataIssue?
return None return None
else: else:
with open(jsonfile) as json_f: with open(jsonfile) as json_f:
@ -60,8 +61,9 @@ class Wallet(models.Model):
waldata = json.load(json_f) waldata = json.load(json_f)
except: except:
message = f"! {str(self.walletname)} Failed to load {jsonfile} JSON file" message = f"! {str(self.walletname)} Failed to load {jsonfile} JSON file"
# print(message) print(message)
raise # Should this be a DataIssue?
return None
if waldata["date"]: if waldata["date"]:
datestr = waldata["date"].replace(".", "-") datestr = waldata["date"].replace(".", "-")
try: try: