diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-09-02 19:43:50 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-09-02 19:43:50 +0300 |
commit | eb7a1efea51dc68a4cb3c2d4da37127ba28a7991 (patch) | |
tree | 26fbaa8af294523477b6ab44eb7aadd274e4b543 /core/models/logbooks.py | |
parent | a4f676fd320ab8bc22ac3233018b88dfa3238855 (diff) | |
download | troggle-eb7a1efea51dc68a4cb3c2d4da37127ba28a7991.tar.gz troggle-eb7a1efea51dc68a4cb3c2d4da37127ba28a7991.tar.bz2 troggle-eb7a1efea51dc68a4cb3c2d4da37127ba28a7991.zip |
Path seems newly fragile re int rather than str
Diffstat (limited to 'core/models/logbooks.py')
-rw-r--r-- | core/models/logbooks.py | 21 |
1 files changed, 10 insertions, 11 deletions
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"<body>", "<body>\n" + frontmatter + endmatter, logbookfile) else: logbookfile = re.sub(r"<body>", f"<body>\n<h1>Expo {year}</h1>\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: |