summaryrefslogtreecommitdiffstats
path: root/parsers/caves.py
diff options
context:
space:
mode:
Diffstat (limited to 'parsers/caves.py')
-rw-r--r--parsers/caves.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/parsers/caves.py b/parsers/caves.py
index 1178399..d69273f 100644
--- a/parsers/caves.py
+++ b/parsers/caves.py
@@ -472,6 +472,13 @@ def read_entrance(filename, ent=None):
contents = f.read()
context = filename
+ # validate filename, check areacode
+ ent_area = filename[:4]
+ if ent_area not in AREACODES:
+ message = f'! BAD AREA CODE in "{filename}". Not recognised.'
+ DataIssue.objects.create(parser="entrances", message=message, url=f"/entrance_data/{filename}_edit")
+ print(message)
+
entrancecontentslist = getXML(contents, "entrance", maxItems=1, context=context)
if len(entrancecontentslist) != 1:
message = f'! BAD ENTRANCE DATA in "{filename}". More than one entrance. Edit file manually, click.'
@@ -840,7 +847,9 @@ def readcaves():
with open(fpending, "r") as fo:
cids = fo.readlines()
for cid in cids:
- pending.add(cid.strip().rstrip("\n"))
+ pcaveid = cid.strip().rstrip("\n")
+ if pcaveid !="":
+ pending.add(pcaveid)
with transaction.atomic():
print(" - Deleting Caves and Entrances")