mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
EPOCH = 1970-01-01
This commit is contained in:
parent
1631111a7f
commit
8b76cad15a
@ -82,7 +82,7 @@ def current_expo():
|
||||
if expos:
|
||||
return expos[0].year
|
||||
else:
|
||||
return "1970"
|
||||
return settings.EPOCH.year
|
||||
|
||||
def only_commit(fname, message):
|
||||
"""Only used to commit a survex file edited and saved in view/survex.py"""
|
||||
|
@ -17,6 +17,7 @@ from troggle.core.models.logbooks import LogbookEntry, PersonLogEntry
|
||||
from troggle.core.models.troggle import DataIssue, Expedition
|
||||
from troggle.core.utils import get_process_memory, alphabet_suffix, unique_slug
|
||||
|
||||
EPOCH = settings.EPOCH
|
||||
"""
|
||||
Parses and imports logbooks in all their wonderful confusion
|
||||
See detailed explanation of the complete process:
|
||||
@ -32,8 +33,6 @@ e.g. cave descriptions
|
||||
|
||||
- attach or link a DataIssue to an individual expo (logbook) so that it can be found and deleted
|
||||
|
||||
- replace explicit 1970 date with a constant EPOCH
|
||||
|
||||
- rewrite to use generators rather than storing everything intermediate in lists - to
|
||||
reduce memory impact [low priority]
|
||||
|
||||
@ -260,8 +259,8 @@ def store_entry_into_database(date, place, tripcave, title, text, trippersons, a
|
||||
faster ?
|
||||
"""
|
||||
other_people = ", ".join(guests) # join list members separated by comma
|
||||
if guests:
|
||||
print(f" {date} - {guests}")
|
||||
# if guests:
|
||||
# print(f" {date} - {guests}")
|
||||
|
||||
nonLookupAttribs = {
|
||||
"place": place,
|
||||
@ -291,7 +290,7 @@ def parser_date(tripdate, year):
|
||||
"""Interprets dates in the expo logbooks and returns a correct datetime.date object
|
||||
Does NOT actually check that it is a truly valid date..
|
||||
"""
|
||||
dummydate = date(1970, 1, 1) # replace with _EPOCH
|
||||
dummydate = EPOCH
|
||||
month = 1
|
||||
day = 1
|
||||
# message = f" ! - Trying to parse date in logbook: {tripdate} - {year}"
|
||||
@ -315,7 +314,7 @@ def parser_date(tripdate, year):
|
||||
yadd = int(year[:2]) * 100
|
||||
day, month, year = int(mdategoof.group(1)), int(mdategoof.group(2)), int(mdategoof.group(4)) + yadd
|
||||
else:
|
||||
year = 1970 # replace with _EPOCH
|
||||
year = EPOCH.year
|
||||
message = f" ! - Bad date in logbook: {tripdate} - {year}"
|
||||
DataIssue.objects.create(parser="logbooks", message=message)
|
||||
|
||||
@ -323,7 +322,7 @@ def parser_date(tripdate, year):
|
||||
except:
|
||||
message = f" ! - Failed to parse date in logbook: {tripdate} - {year}"
|
||||
DataIssue.objects.create(parser="logbooks", message=message)
|
||||
return datetime.date(1970, 1, 1) # replace with _EPOCH
|
||||
return EPOCH
|
||||
|
||||
|
||||
def parser_html(year, expedition, txt, seq=""):
|
||||
|
@ -1,4 +1,6 @@
|
||||
import sys
|
||||
from datetime import date
|
||||
|
||||
"""
|
||||
Django settings for troggle project.
|
||||
|
||||
@ -23,7 +25,9 @@ if 'runserver' in sys.argv:
|
||||
DEVSERVER = True
|
||||
else:
|
||||
DEVSERVER = False
|
||||
|
||||
|
||||
EPOCH = date.fromisoformat('1970-01-01')
|
||||
|
||||
# default value, then gets overwritten by real secrets
|
||||
SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user