mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
bugfixing
This commit is contained in:
parent
1a8bc17f80
commit
a4f676fd32
@ -103,21 +103,38 @@ def writelogbook(year, filename):
|
|||||||
"slug"
|
"slug"
|
||||||
) # now that slug, aka tripid, is in our standard date form, this will preserve ordering.
|
) # 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"
|
template = "logbook2005style.html"
|
||||||
|
|
||||||
t = loader.get_template(template)
|
try:
|
||||||
logbookfile = t.render({"logbook_entries": logbook_entries})
|
t = loader.get_template(template)
|
||||||
|
logbookfile = t.render({"logbook_entries": logbook_entries})
|
||||||
endpath = Path(settings.EXPOWEB, "years", year, "endmatter.html")
|
except:
|
||||||
endmatter = ""
|
print(" ! Very Bad Error RENDERING template " + template)
|
||||||
if endpath.is_file():
|
raise
|
||||||
|
print(" - template rendered")
|
||||||
|
try:
|
||||||
|
print(" - end")
|
||||||
|
print(f" - endmatter {year} {filename} {settings.EXPOWEB}")
|
||||||
try:
|
try:
|
||||||
with open(endpath, "r") as end:
|
endpath = Path(settings.EXPOWEB, "years", year, "endmatter.html")
|
||||||
endmatter = end.read()
|
|
||||||
except:
|
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")
|
frontpath = Path(settings.EXPOWEB, "years", year, "frontmatter.html")
|
||||||
if frontpath.is_file():
|
if frontpath.is_file():
|
||||||
@ -129,11 +146,16 @@ 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")
|
||||||
|
|
||||||
dir = Path(settings.EXPOWEB) / "years" / year
|
dir = Path(settings.EXPOWEB) / "years" / year
|
||||||
filepath = Path(dir, filename)
|
filepath = Path(dir, filename)
|
||||||
with (open(filepath, "w")) as lb:
|
try:
|
||||||
lb.writelines(logbookfile)
|
with (open(filepath, "w")) as lb:
|
||||||
|
lb.writelines(logbookfile)
|
||||||
|
except:
|
||||||
|
print(" ! Very Bad Error writing to " + filepath)
|
||||||
|
raise
|
||||||
|
|
||||||
# print(f'Logbook exported to {filepath}')
|
# print(f'Logbook exported to {filepath}')
|
||||||
|
|
||||||
|
@ -81,8 +81,9 @@ def store_edited_entry_into_database(date, place, title, text, others, author, t
|
|||||||
"expedition": expedition,
|
"expedition": expedition,
|
||||||
"time_underground": tu,
|
"time_underground": tu,
|
||||||
"cave_slug": str(cave),
|
"cave_slug": str(cave),
|
||||||
|
"title": f"{place} - {title}"
|
||||||
}
|
}
|
||||||
lookupAttribs = {"slug": slug, "date": date, "title": title}
|
lookupAttribs = {"slug": slug, "date": date }
|
||||||
|
|
||||||
lbo = LogbookEntry.objects.create(**nonLookupAttribs, **lookupAttribs)
|
lbo = LogbookEntry.objects.create(**nonLookupAttribs, **lookupAttribs)
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None):
|
|||||||
|
|
||||||
if not author:
|
if not author:
|
||||||
if not res:
|
if not res:
|
||||||
return "", 0
|
return "", 0, ""
|
||||||
author = res[-1][0] # the previous valid person and a time of 0 hours
|
author = res[-1][0] # the previous valid person and a time of 0 hours
|
||||||
|
|
||||||
# print(f" - {tid} [{author.person}] '{res[0][0].person}'...")
|
# print(f" - {tid} [{author.person}] '{res[0][0].person}'...")
|
||||||
|
Loading…
Reference in New Issue
Block a user