diff --git a/core/models/logbooks.py b/core/models/logbooks.py index 03a06a9..eb8d649 100644 --- a/core/models/logbooks.py +++ b/core/models/logbooks.py @@ -103,21 +103,38 @@ def writelogbook(year, filename): "slug" ) # now that slug, aka tripid, is in our standard date form, this will preserve ordering. - print(f"Logbook exported has {len(logbook_entries)} entries in it.") + print(f" - Logbook to be exported has {len(logbook_entries)} entries in it.") template = "logbook2005style.html" - t = loader.get_template(template) - logbookfile = t.render({"logbook_entries": logbook_entries}) - - endpath = Path(settings.EXPOWEB, "years", year, "endmatter.html") - endmatter = "" - if endpath.is_file(): + try: + t = loader.get_template(template) + logbookfile = t.render({"logbook_entries": logbook_entries}) + except: + print(" ! Very Bad Error RENDERING template " + template) + raise + print(" - template rendered") + try: + print(" - end") + print(f" - endmatter {year} {filename} {settings.EXPOWEB}") try: - with open(endpath, "r") as end: - endmatter = end.read() + endpath = Path(settings.EXPOWEB, "years", year, "endmatter.html") except: - print(" ! Very Bad Error opening " + endpath) + print(" ! FAIL Path " + {(settings.EXPOWEB, "years", year, "endmatter.html")}) + print(f" - endpath {endpath}") + endmatter = "" + if endpath.is_file(): + print(" - endpath") + + try: + with open(endpath, "r") as end: + endmatter = end.read() + except: + print(" ! Very Bad Error opening " + endpath) + except: + print(" ! FAIL endpath " + endpath) + raise + print(" - endpath opened") frontpath = Path(settings.EXPOWEB, "years", year, "frontmatter.html") if frontpath.is_file(): @@ -129,11 +146,16 @@ def writelogbook(year, filename): logbookfile = re.sub(r"
", "\n" + frontmatter + endmatter, logbookfile) else: logbookfile = re.sub(r"", f"\n