summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-08-25 21:49:05 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2023-08-25 21:49:05 +0300
commitf2a76da7e260530a798fafe7d6132d63ca6e90b3 (patch)
treea5a482efbd1b2c4a4460174029b92690cbf5fbe4
parent3d51588cc14e46e5168d2b177aab73d1f37bc268 (diff)
downloadtroggle-f2a76da7e260530a798fafe7d6132d63ca6e90b3.tar.gz
troggle-f2a76da7e260530a798fafe7d6132d63ca6e90b3.tar.bz2
troggle-f2a76da7e260530a798fafe7d6132d63ca6e90b3.zip
fix error in test suite when full reset has not been done
-rw-r--r--core/views/statistics.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/core/views/statistics.py b/core/views/statistics.py
index d18ca57..ebe70dd 100644
--- a/core/views/statistics.py
+++ b/core/views/statistics.py
@@ -82,11 +82,16 @@ def therionissues(request):
newlog = []
if Path(logpath).is_file:
- with open(logpath, "r") as f:
- therionlog = f.readlines()
- print(f"{logpath} has {len(therionlog)} entries")
+ try:
+ with open(logpath, "r") as f:
+ therionlog = f.readlines()
+ print(f"{logpath} has {len(therionlog)} entries")
+ except:
+ msg = f"{logpath} EXCEPTION opening or reading therion logfile. Run a full reset."
+ print(msg)
+ return render(request, "therionreport.html", {"therionlog": newlog})
else:
- print(f"{logpath} NOT FOUND {len(therionlog)}")
+ print(f"{logpath} NOT FOUND: {len(therionlog)} entries")
for line in therionlog:
line = line.replace("! Un-parsed image filename:", "")