mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-21 23:01:52 +00:00
Path seems newly fragile re int rather than str
This commit is contained in:
parent
a4f676fd32
commit
eb7a1efea5
@ -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:
|
||||
|
@ -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
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user