From e64cb212c19cd7bca1771381dd43740044ca5a5b Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 11 Aug 2024 14:07:26 +0300 Subject: [PATCH] make more robust --- core/models/wallets.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/models/wallets.py b/core/models/wallets.py index 4077961..7dacc7d 100644 --- a/core/models/wallets.py +++ b/core/models/wallets.py @@ -155,9 +155,11 @@ class Wallet(models.Model): wname = fp.name wyear = fp.parent.name - if not int(wyear): - message = f"! Subfolder detected?:\n {wyear=} (should be eg. '2023')\n {wname=} \n {self.fpath=}" - print(message) + try: + y = int(wyear) + except: + message = f"! Subfolder detected?:\n {wyear=} (should be eg. '2023')\n {wname=} \n {self.fpath=}" + print(message) wurl = self.get_url() if len(wyear) != 4 or len(wname) !=6: