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.") 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 # FInd the cave, if it exists
try: if waldata["cave"]:
caveobject = getCave(waldata["cave"]) try:
print(f'getCave for id "{waldata["cave"]}" {caveobject}') caveobject = getCave(waldata["cave"])
if not caveobject.url == waldata["description url"]: print(f'getCave for id "{waldata["cave"]}" {caveobject}')
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.') if not caveobject.url == waldata["description url"]:
except Cave.MultipleObjectsReturned: 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.')
complaints.append(f'The cave ID \'{waldata["cave"]}\' is AMBIGUOUS. Please fix it.') 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 caveobject = None
except ObjectDoesNotExist:
complaints.append(f'The cave ID \'{waldata["cave"]}\' is not recognised. Please fix it.')
caveobject = None
return complaints, caveobject return complaints, caveobject