From 7f16bca7f7fdba13267af8724b63396dea6d07da Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 29 Mar 2022 15:31:25 +0100 Subject: [PATCH] Better error messaged and url --- core/views/uploads.py | 2 +- parsers/survex.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/views/uploads.py b/core/views/uploads.py index ded99f2..f572e8f 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -140,7 +140,7 @@ def scanupload(request, path=None): if int(wnumber) == 0: prev = f'{int(wnumber):02d}' - wurl = f"/scanupload/{wallet}" + wurl = f"/scanupload/{wallet}".replace('#', ':') wallet = wallet.replace(':','#') dirpath = Path(settings.SURVEY_SCANS, year, wallet) contents_path = dirpath / contentsjson diff --git a/parsers/survex.py b/parsers/survex.py index cce017d..7f7c902 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -190,7 +190,7 @@ class LoadingSurvex(): pass # we ignore all these, which is fine. else: if cmd in ["include", "data", "flags", "title", "entrance","set", "units", "alias", "ref"]: - message = "! Unparsed [*{}]: '{}' {}".format(cmd, line, survexblock.survexfile.path) + message = "! Unparsed [*{}]: '{}' {} - not an error (probably)".format(cmd, line, survexblock.survexfile.path) print((self.insp+message)) DataIssue.objects.create(parser='survex', message=message) else: @@ -466,7 +466,7 @@ class LoadingSurvex(): if argsgps: yr, letterx, wallet = argsgps.groups() else: - message = " ! Wallet *REF '{}' in '{}' ".format(args, survexblock.survexfile.path) + message = " ! Wallet *REF '{}' malformed id in '{}' ".format(args, survexblock.survexfile.path) print(self.insp+message) DataIssue.objects.create(parser='survex', message=message, url=url) return @@ -484,7 +484,7 @@ class LoadingSurvex(): refscan = "%s#%s%s" % (yr, letterx, wallet) try: - if int(wallet)>100: + if int(wallet)>99: message = " ! Wallet *REF {} - too big in '{}'".format(refscan, survexblock.survexfile.path) print((self.insp+message)) DataIssue.objects.create(parser='survex', message=message, url=url) @@ -498,11 +498,11 @@ class LoadingSurvex(): print(manywallets[0]) survexblock.save() if len(manywallets) > 1: - message = " ! Wallet *REF {} - {} scan folders from DB search in {} -- parsing continues".format(refscan, len(manywallets), survexblock.survexfile.path) + message = " ! Wallet *REF {} - more than one found {} scan folders in {}".format(refscan, len(manywallets), survexblock.survexfile.path) print((self.insp+message)) DataIssue.objects.create(parser='survex', message=message, url=url) else: - message = " ! Wallet *REF '{}' - NOT found in DB search '{}' -- parsing continues".format(refscan, survexblock.survexfile.path) + message = " ! Wallet *REF '{}' - NOT found '{}'".format(refscan, survexblock.survexfile.path) print((self.insp+message)) DataIssue.objects.create(parser='survex', message=message, url=url)