forked from expo/troggle
better integration of svx file DatIssues
This commit is contained in:
@@ -43,31 +43,34 @@ def readcaves():
|
||||
print (" - Setting pending caves")
|
||||
# Do this first, so that these empty entries are overwritten as they get properly created.
|
||||
|
||||
# For those caves which do not have XML files even though they exist and have surveys
|
||||
# For those caves which do not have cave_data/1623-xxx.html XML files even though they exist and have surveys
|
||||
# also needs to be done *before* entrances so that the entrance-cave links work properly.
|
||||
pending = ["2007-04", "2007-05", "2007-06", "2007-07", "2007-12", "2009-01", "2009-02",
|
||||
"2010-06", "2010-07", "2012-ns-01", "2012-ns-02", "2010-04", "2012-ns-05", "2012-ns-06",
|
||||
"2012-ns-07", "2012-ns-08", "2012-ns-12", "2012-ns-14", "2012-ns-15", "2014-bl888",
|
||||
"2018-pf-01", "2018-pf-02", "haldenloch", "gruenstein"]
|
||||
"2018-pf-01", "2018-pf-02", "haldenloch"]
|
||||
for k in pending:
|
||||
try:
|
||||
url = "1623/" + k
|
||||
try:
|
||||
cave = Cave(
|
||||
unofficial_number = k,
|
||||
# official_name = "",
|
||||
underground_description = "Pending cave write-up - creating as empty object. No XML file available yet.",
|
||||
notes="_Survex file found in loser repo but no description in expoweb")
|
||||
# official_name = "",
|
||||
underground_description = "Pending cave write-up - creating as empty object. No XML file available yet.",
|
||||
survex_file = "caves-1623/" + k + "/" + k +".svx",
|
||||
url = url,
|
||||
notes="_Survex file found in loser repo but no description in expoweb")
|
||||
if cave:
|
||||
cave.save() # must save to have id before foreign keys work. This is also a ManyToMany key.
|
||||
#print(f' ! - READ CAVES: cave {k} {cave}')
|
||||
cave.area.add(area_1623[0])
|
||||
cave.save()
|
||||
message = " ! {:11s} {}".format(cave.unofficial_number, cave.underground_description)
|
||||
DataIssue.objects.create(parser='caves', message=message)
|
||||
DataIssue.objects.create(parser='caves', message=message, url=url)
|
||||
print(message)
|
||||
|
||||
try: # Now create a cave slug ID
|
||||
cs = CaveSlug.objects.update_or_create(cave = cave,
|
||||
slug = "TEMP-" + k,
|
||||
slug = "1623-PENDING-" + k,
|
||||
primary = False)
|
||||
except:
|
||||
message = " ! {:11s} {} PENDING cave slug create failure".format(k)
|
||||
@@ -316,6 +319,8 @@ def readcave(filename):
|
||||
message = f' ! description filename does not exist :{EXPOWEB}:"{description_file[0]}" in "{filename}"'
|
||||
DataIssue.objects.create(parser='caves', message=message, url=f'/cave/{slug}/edit/')
|
||||
print(message)
|
||||
#c.description_file="" # done only once, to clear out cruft.
|
||||
#c.save()
|
||||
|
||||
def getXML(text, itemname, minItems = 1, maxItems = None, printwarnings = True, context = ""):
|
||||
items = re.findall("<%(itemname)s>(.*?)</%(itemname)s>" % {"itemname": itemname}, text, re.S)
|
||||
|
||||
Reference in New Issue
Block a user