diff options
author | Sam Wenham <sam@wenhams.co.uk> | 2020-02-24 15:04:07 +0000 |
---|---|---|
committer | Sam Wenham <sam@wenhams.co.uk> | 2020-02-24 15:04:07 +0000 |
commit | 43dfe946b6385037141b94b775112037fe5f032f (patch) | |
tree | 72c352e67166f0702ab93d7063c902ff1bd2c621 /parsers/QMs.py | |
parent | 656ddcfe93061f2f82160ff8cc45b98d27e28bd3 (diff) | |
download | troggle-django-1.10.tar.gz troggle-django-1.10.tar.bz2 troggle-django-1.10.zip |
Just removing dud whitespacedjango-1.10
Diffstat (limited to 'parsers/QMs.py')
-rw-r--r-- | parsers/QMs.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/parsers/QMs.py b/parsers/QMs.py index 602b7af..9de3b4d 100644 --- a/parsers/QMs.py +++ b/parsers/QMs.py @@ -30,7 +30,7 @@ def parseCaveQMs(cave,inputFile): kh=Cave.objects.get(official_name="Kaninchenhöhle") except Cave.DoesNotExist: print("KH is not in the database. Please run parsers.cavetab first.") - parse_KH_QMs(kh, inputFile=inputFile) + parse_KH_QMs(kh, inputFile=inputFile) return qmPath = settings.EXPOWEB+inputFile @@ -46,7 +46,7 @@ def parseCaveQMs(cave,inputFile): if cave=='stein': placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, title="placeholder for QMs in 204", text="QMs temporarily attached to this should be re-attached to their actual trips", defaults={"date": date(year, 1, 1),"cave":steinBr}) elif cave=='hauch': - placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, title="placeholder for QMs in 234", text="QMs temporarily attached to this should be re-attached to their actual trips", defaults={"date": date(year, 1, 1),"cave":hauchHl}) + placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, title="placeholder for QMs in 234", text="QMs temporarily attached to this should be re-attached to their actual trips", defaults={"date": date(year, 1, 1),"cave":hauchHl}) if hadToCreate: print(cave + " placeholder logbook entry for " + str(year) + " added to database") QMnum=re.match(r".*?-\d*?-X?(?P<numb>\d*)",line[0]).group("numb") @@ -59,7 +59,7 @@ def parseCaveQMs(cave,inputFile): newQM.grade=line[1] newQM.area=line[2] newQM.location_description=line[3] - + newQM.completion_description=line[4] newQM.nearest_station_description=line[5] if newQM.completion_description: # Troggle checks if QMs are completed by checking if they have a ticked_off_by trip. In the table, completion is indicated by the presence of a completion discription. @@ -74,11 +74,11 @@ def parseCaveQMs(cave,inputFile): print("overwriting " + str(preexistingQM) +"\r") else: # otherwise, print that it was ignored print("preserving " + str(preexistingQM) + ", which was edited in admin \r") - + except QM.DoesNotExist: #if there is no pre-existing QM, save the new one - newQM.save() + newQM.save() print("QM "+str(newQM) + ' added to database\r') - + except KeyError: #check on this one continue except IndexError: @@ -106,9 +106,9 @@ def parse_KH_QMs(kh, inputFile): 'nearest_station_name':res['nearest_station'], 'location_description':res['description'] } - + save_carefully(QM,lookupArgs,nonLookupArgs) - + parseCaveQMs(cave='stein',inputFile=r"1623/204/qm.csv") parseCaveQMs(cave='hauch',inputFile=r"1623/234/qm.csv") |