From 278a84a485c4ea02fbb8965582af600cec3c26cc Mon Sep 17 00:00:00 2001 From: Philip Sargent <philip.sargent@klebos.com> Date: Sat, 9 Jul 2022 01:54:48 +0300 Subject: [PATCH] better error msg --- parsers/survex.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/parsers/survex.py b/parsers/survex.py index acc76dd..70ff0d3 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -36,6 +36,8 @@ todo = '''Also walk the entire tree in the :loser: repo looking for unconnected - LoadSurvexFile() Creates a new current survexfile and valid .survexdirectory The survexblock passed-in is not necessarily the parent. FIX THIS. + +- rx_qm recognises only simple survey point ids. EXTEND to cover more naming formats and test fully for 2023 ''' survexblockroot = None ROOTBLOCK = "rootblock" @@ -118,6 +120,7 @@ class LoadingSurvex(): rx_teammem = re.compile(r"(?i)"+instruments+"?(?:es|s)?\s+(.*)"+instruments+"?(?:es|s)?$") rx_person = re.compile(r"(?i) and | / |, | & | \+ |^both$|^none$") rx_qm = re.compile(r'(?i)^\s*QM(\d)\s+?([a-dA-DxX])\s+([\w\-]+)\.(\d+)\s+(([\w\-]+)\.(\d+)|\-)\s+(.+)$') + # does not recognise non numeric suffix survey point ids rx_qm0 = re.compile(r'(?i)^\s*QM(\d)\s+(.+)$') # remember there is also QM_PATTERN used in views.other and set in settings.py rx_tapelng = re.compile(r'(?i).*(tape|length).*$') @@ -807,6 +810,8 @@ class LoadingSurvex(): # ignore all comments except ;ref, ; wallet and ;QM and ;*include (for collated survex file) # rx_ref2 = re.compile(r'(?i)\s*ref[.;]?') # rx_ref3 = re.compile(r'(?i)\s*wallet[.;]?') + + # This should also check that the QM survey point rxists in the block refline = self.rx_commref.match(comment) if refline: @@ -828,7 +833,7 @@ class LoadingSurvex(): if qmline: self.LoadSurvexQM(survexblock, qmline) else: - message = f' ! QM Unrecognised as a valid QM in "{survexblock.survexfile.path}" {qml}' + message = f' ! QM Unrecognised as a valid QM in "{survexblock.survexfile.path}" QM{qml.group(1)} {qml.group(2)}' print(message) DataIssue.objects.create(parser='survex', message=message)