diff --git a/core/models/logbooks.py b/core/models/logbooks.py index eb8d649..7aefa3f 100644 --- a/core/models/logbooks.py +++ b/core/models/logbooks.py @@ -113,30 +113,29 @@ def writelogbook(year, filename): except: print(" ! Very Bad Error RENDERING template " + template) raise - print(" - template rendered") + # print(" - template rendered") try: - print(" - end") - print(f" - endmatter {year} {filename} {settings.EXPOWEB}") try: - endpath = Path(settings.EXPOWEB, "years", year, "endmatter.html") + endpath = Path(settings.EXPOWEB, "years", str(year), "endmatter.html") except: print(" ! FAIL Path " + {(settings.EXPOWEB, "years", year, "endmatter.html")}) - print(f" - endpath {endpath}") + raise + # print(f" - endpath {endpath}") endmatter = "" if endpath.is_file(): - print(" - endpath") - + # print(" - endpath") try: with open(endpath, "r") as end: endmatter = end.read() except: print(" ! Very Bad Error opening " + endpath) + raise except: print(" ! FAIL endpath " + endpath) raise - print(" - endpath opened") + # print(" - endpath opened") - frontpath = Path(settings.EXPOWEB, "years", year, "frontmatter.html") + frontpath = Path(settings.EXPOWEB, "years", str(year), "frontmatter.html") if frontpath.is_file(): try: with open(frontpath, "r") as front: @@ -146,9 +145,9 @@ def writelogbook(year, filename): logbookfile = re.sub(r"", "\n" + frontmatter + endmatter, logbookfile) else: logbookfile = re.sub(r"", f"\n

Expo {year}

\n" + endmatter, logbookfile) - print(" - frontmatter opened") + # print(" - frontmatter opened") - dir = Path(settings.EXPOWEB) / "years" / year + dir = Path(settings.EXPOWEB) / "years" / str(year) filepath = Path(dir, filename) try: with (open(filepath, "w")) as lb: diff --git a/core/views/uploads.py b/core/views/uploads.py index 0031f24..d1d4402 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -228,7 +228,7 @@ def logbookedit(request, year=None, slug=None): #TO DO author and team validation, and check that 'place' is not deleted and that *bloke not forgotten git = settings.GIT - dirpath = Path(settings.EXPOWEB) / "years" / year + dirpath = Path(settings.EXPOWEB) / "years" / str(year) lbe_add = subprocess.run( [git, "add", filename], cwd=dirpath, capture_output=True, text=True )