2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-14 18:47:04 +00:00

url to full logbooks fixed in logbookentry

This commit is contained in:
Philip Sargent
2022-03-23 23:35:42 +00:00
parent 9ccf5912d4
commit 13ffe1fcc6
2 changed files with 36 additions and 36 deletions

View File

@@ -581,14 +581,14 @@ def LoadLogbookForExpedition(expedition, expect):
cleanerrors(expedition.year)
if expedition.year in yearlinks:
logbookfile = os.path.join(expologbase, yearlinks[expedition.year][0])
logbookpath = Path(expologbase) / expedition.year / yearlinks[expedition.year][0]
expedition.logbookfile = yearlinks[expedition.year][0]
parsefunc = yearlinks[expedition.year][1]
else:
logbookfile = os.path.join(expologbase, expedition.year, settings.DEFAULT_LOGBOOK_FILE)
logbookpath = os.path.join(expologbase, expedition.year, settings.DEFAULT_LOGBOOK_FILE)
expedition.logbookfile = settings.DEFAULT_LOGBOOK_FILE
parsefunc = settings.DEFAULT_LOGBOOK_PARSER
cache_filename = Path(logbookfile + ".cache")
cache_filename = Path(str(logbookpath) + ".cache")
if not cache_filename.is_file():
print(" - Cache file does not exist \"" + str(cache_filename) +"\"")
@@ -599,7 +599,7 @@ def LoadLogbookForExpedition(expedition, expect):
bad_cache = False # temporarily disable reading the cache - buggy
try:
cache_t = os.path.getmtime(cache_filename)
if os.path.getmtime(logbookfile) - cache_t > 2: # at least 2 secs later
if os.path.getmtime(logbookpath) - cache_t > 2: # at least 2 secs later
print(" - ! Cache is older than the logbook file")
bad_cache= True
if now - cache_t > 30*24*60*60:
@@ -629,13 +629,13 @@ def LoadLogbookForExpedition(expedition, expect):
except :
print(" - Cache de-pickle failure \"" + str(cache_filename) +"\"")
try:
file_in = open(logbookfile,'rb')
file_in = open(logbookpath,'rb')
txt = file_in.read().decode("latin1")
file_in.close()
logbook_parseable = True
except (IOError):
logbook_parseable = False
print((" ! Couldn't open logbook " + logbookfile))
print((" ! Couldn't open logbook " + logbookpath))
if logbook_parseable:
parser = globals()[parsefunc]