This commit is contained in:
Philip Sargent 2022-07-17 15:22:26 +03:00
parent b20e6c5a58
commit bb65ffaee6

View File

@ -162,18 +162,22 @@ def get_complaints(complaints, waldata, svxfiles, files):
complaints.append("The cave description website is marked as needing updating using the guidebook description from the survex file. Tick the 'Website updated' checkbox when this is done.")
# FInd the cave, if it exists
try:
caveobject = getCave(waldata["cave"])
print(f'getCave for id "{waldata["cave"]}" {caveobject}')
if not caveobject.url == waldata["description url"]:
complaints.append(f'The URL of cave description \"{waldata["description url"]}\" does not match the one on record for this cave which is: "{caveobject.url}". If the wallet is not for a cave, put a useful URL here.')
except Cave.MultipleObjectsReturned:
complaints.append(f'The cave ID \'{waldata["cave"]}\' is AMBIGUOUS. Please fix it.')
if waldata["cave"]:
try:
caveobject = getCave(waldata["cave"])
print(f'getCave for id "{waldata["cave"]}" {caveobject}')
if not caveobject.url == waldata["description url"]:
complaints.append(f'The URL of cave description \"{waldata["description url"]}\" does not match the one on record for this cave which is: "{caveobject.url}". If the wallet is not for a cave, put a useful URL here.')
except Cave.MultipleObjectsReturned:
complaints.append(f'The cave ID \'{waldata["cave"]}\' is AMBIGUOUS. Please fix it.')
caveobject = None
except ObjectDoesNotExist:
complaints.append(f'The cave ID \'{waldata["cave"]}\' is not recognised. Please fix it.')
caveobject = None
else:
complaints.append(f'No cave ID is given. Please give an ID, even if it is just "surface survey" or "scraps found in hut"')
caveobject = None
except ObjectDoesNotExist:
complaints.append(f'The cave ID \'{waldata["cave"]}\' is not recognised. Please fix it.')
caveobject = None
return complaints, caveobject