mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 15:57:09 +00:00
Path seems newly fragile re int rather than str
This commit is contained in:
@@ -113,30 +113,29 @@ def writelogbook(year, filename):
|
|||||||
except:
|
except:
|
||||||
print(" ! Very Bad Error RENDERING template " + template)
|
print(" ! Very Bad Error RENDERING template " + template)
|
||||||
raise
|
raise
|
||||||
print(" - template rendered")
|
# print(" - template rendered")
|
||||||
try:
|
try:
|
||||||
print(" - end")
|
|
||||||
print(f" - endmatter {year} {filename} {settings.EXPOWEB}")
|
|
||||||
try:
|
try:
|
||||||
endpath = Path(settings.EXPOWEB, "years", year, "endmatter.html")
|
endpath = Path(settings.EXPOWEB, "years", str(year), "endmatter.html")
|
||||||
except:
|
except:
|
||||||
print(" ! FAIL Path " + {(settings.EXPOWEB, "years", year, "endmatter.html")})
|
print(" ! FAIL Path " + {(settings.EXPOWEB, "years", year, "endmatter.html")})
|
||||||
print(f" - endpath {endpath}")
|
raise
|
||||||
|
# print(f" - endpath {endpath}")
|
||||||
endmatter = ""
|
endmatter = ""
|
||||||
if endpath.is_file():
|
if endpath.is_file():
|
||||||
print(" - endpath")
|
# print(" - endpath")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(endpath, "r") as end:
|
with open(endpath, "r") as end:
|
||||||
endmatter = end.read()
|
endmatter = end.read()
|
||||||
except:
|
except:
|
||||||
print(" ! Very Bad Error opening " + endpath)
|
print(" ! Very Bad Error opening " + endpath)
|
||||||
|
raise
|
||||||
except:
|
except:
|
||||||
print(" ! FAIL endpath " + endpath)
|
print(" ! FAIL endpath " + endpath)
|
||||||
raise
|
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():
|
if frontpath.is_file():
|
||||||
try:
|
try:
|
||||||
with open(frontpath, "r") as front:
|
with open(frontpath, "r") as front:
|
||||||
@@ -146,9 +145,9 @@ def writelogbook(year, filename):
|
|||||||
logbookfile = re.sub(r"<body>", "<body>\n" + frontmatter + endmatter, logbookfile)
|
logbookfile = re.sub(r"<body>", "<body>\n" + frontmatter + endmatter, logbookfile)
|
||||||
else:
|
else:
|
||||||
logbookfile = re.sub(r"<body>", f"<body>\n<h1>Expo {year}</h1>\n" + endmatter, logbookfile)
|
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)
|
filepath = Path(dir, filename)
|
||||||
try:
|
try:
|
||||||
with (open(filepath, "w")) as lb:
|
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
|
#TO DO author and team validation, and check that 'place' is not deleted and that *bloke not forgotten
|
||||||
git = settings.GIT
|
git = settings.GIT
|
||||||
dirpath = Path(settings.EXPOWEB) / "years" / year
|
dirpath = Path(settings.EXPOWEB) / "years" / str(year)
|
||||||
lbe_add = subprocess.run(
|
lbe_add = subprocess.run(
|
||||||
[git, "add", filename], cwd=dirpath, capture_output=True, text=True
|
[git, "add", filename], cwd=dirpath, capture_output=True, text=True
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user