summaryrefslogtreecommitdiffstats
path: root/parsers/QMs.py
diff options
context:
space:
mode:
authorWookey <wookey@wookware.org>2019-04-02 00:57:54 +0100
committerWookey <wookey@wookware.org>2019-04-02 00:57:54 +0100
commitc4301cf6df56ba1bef4f2c908b949a2b45ea65dc (patch)
tree9c6bb4a4530824c8e072984a0346509298188030 /parsers/QMs.py
parentde7d68b1eb70542f66092cb0048af3d096e6980c (diff)
parentbb8dbb381fe87c3a63e9586a1bf1e993b09c965b (diff)
downloadtroggle-c4301cf6df56ba1bef4f2c908b949a2b45ea65dc.tar.gz
troggle-c4301cf6df56ba1bef4f2c908b949a2b45ea65dc.tar.bz2
troggle-c4301cf6df56ba1bef4f2c908b949a2b45ea65dc.zip
Merge lots of troggle fixes
Diffstat (limited to 'parsers/QMs.py')
-rw-r--r--parsers/QMs.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/parsers/QMs.py b/parsers/QMs.py
index efc8cd6..602b7af 100644
--- a/parsers/QMs.py
+++ b/parsers/QMs.py
@@ -17,19 +17,19 @@ def parseCaveQMs(cave,inputFile):
try:
steinBr=Cave.objects.get(official_name="Steinbr&uuml;ckenh&ouml;hle")
except Cave.DoesNotExist:
- print "Steinbruckenhoehle is not in the database. Please run parsers.cavetab first."
+ print("Steinbruckenhoehle is not in the database. Please run parsers.cavetab first.")
return
elif cave=='hauch':
try:
hauchHl=Cave.objects.get(official_name="Hauchh&ouml;hle")
except Cave.DoesNotExist:
- print "Hauchhoele is not in the database. Please run parsers.cavetab first."
+ print("Hauchhoele is not in the database. Please run parsers.cavetab first.")
return
elif cave =='kh':
try:
kh=Cave.objects.get(official_name="Kaninchenh&ouml;hle")
except Cave.DoesNotExist:
- print "KH is not in the database. Please run parsers.cavetab first."
+ print("KH is not in the database. Please run parsers.cavetab first.")
parse_KH_QMs(kh, inputFile=inputFile)
return
@@ -48,7 +48,7 @@ def parseCaveQMs(cave,inputFile):
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})
if hadToCreate:
- print cave+" placeholder logbook entry for " + str(year) + " added to database"
+ print(cave + " placeholder logbook entry for " + str(year) + " added to database")
QMnum=re.match(r".*?-\d*?-X?(?P<numb>\d*)",line[0]).group("numb")
newQM = QM()
newQM.found_by=placeholder
@@ -71,19 +71,18 @@ def parseCaveQMs(cave,inputFile):
if preexistingQM.new_since_parsing==False: #if the pre-existing QM has not been modified, overwrite it
preexistingQM.delete()
newQM.save()
- print "overwriting " + str(preexistingQM) +"\r",
-
+ print("overwriting " + str(preexistingQM) +"\r")
else: # otherwise, print that it was ignored
- print "preserving "+ str(preexistingQM) + ", which was edited in admin \r",
+ 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()
- print "QM "+str(newQM) + ' added to database\r',
+ print("QM "+str(newQM) + ' added to database\r')
except KeyError: #check on this one
continue
except IndexError:
- print "Index error in " + str(line)
+ print("Index error in " + str(line))
continue
def parse_KH_QMs(kh, inputFile):
@@ -104,7 +103,7 @@ def parse_KH_QMs(kh, inputFile):
}
nonLookupArgs={
'grade':res['grade'],
- 'nearest_station':res['nearest_station'],
+ 'nearest_station_name':res['nearest_station'],
'location_description':res['description']
}
@@ -115,3 +114,4 @@ parseCaveQMs(cave='stein',inputFile=r"1623/204/qm.csv")
parseCaveQMs(cave='hauch',inputFile=r"1623/234/qm.csv")
parseCaveQMs(cave='kh', inputFile="1623/161/qmtodo.htm")
#parseCaveQMs(cave='balkonhoehle',inputFile=r"1623/264/qm.csv")
+