summaryrefslogtreecommitdiffstats
path: root/parsers
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-03-23 23:35:42 +0000
committerPhilip Sargent <philip.sargent@klebos.com>2022-03-23 23:35:42 +0000
commit13ffe1fcc60bf0f490d5cea57a75e3d00a2897f9 (patch)
tree136a76139721255e9a2d958caf723c91e534de8c /parsers
parent9ccf5912d4f77b6eaf083f1cee680bb22c4b3ceb (diff)
downloadtroggle-13ffe1fcc60bf0f490d5cea57a75e3d00a2897f9.tar.gz
troggle-13ffe1fcc60bf0f490d5cea57a75e3d00a2897f9.tar.bz2
troggle-13ffe1fcc60bf0f490d5cea57a75e3d00a2897f9.zip
url to full logbooks fixed in logbookentry
Diffstat (limited to 'parsers')
-rw-r--r--parsers/logbooks.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index 5ebc671..e91c69e 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -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]