From 5f46d8fdc50918551dcc50d172e0558c209b495c Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 22 Mar 2023 15:18:16 +0000 Subject: [PATCH] Fix bugs --- core/TESTS/tests.py | 4 ++-- core/views/wallets_edit.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/TESTS/tests.py b/core/TESTS/tests.py index e5c4349..078a048 100644 --- a/core/TESTS/tests.py +++ b/core/TESTS/tests.py @@ -272,7 +272,7 @@ class PageTests(TestCase): for ph in [ r'a href="/expofiles/documents/bier-tent-instructions.pdf">bier-tent-instructions.pdf', r'a href="/expofiles/documents/boc.pdf">boc.pdf', - r'a href="/expofiles/documents/bierbook">/bierbook', + r'a href="/expofiles/documents/idiots-guide-expo-git.pdf"', ]: phmatch = re.search(ph, content) self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'") @@ -343,7 +343,7 @@ class PageTests(TestCase): def test_page_expofile_document_rope_pdf(self): # Flat file tests. - response = self.client.get("/expofiles/documents/rope-age-agm-2019.pdf") + response = self.client.get("/expofiles/documents/ropes/rope-age-agm-2019.pdf") if response.status_code != HTTPStatus.OK: self.assertEqual(response.status_code, HTTPStatus.FOUND) if response.status_code != HTTPStatus.FOUND: diff --git a/core/views/wallets_edit.py b/core/views/wallets_edit.py index a2793b2..320217e 100644 --- a/core/views/wallets_edit.py +++ b/core/views/wallets_edit.py @@ -20,6 +20,7 @@ from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole from troggle.core.models.troggle import DataIssue, Expedition from troggle.core.models.wallets import Wallet, YEAR_RANGE +from troggle.core.views.auth import login_required_if_public from troggle.core.views.caves import getCave from troggle.core.views.scans import caveifywallet, oldwallet from troggle.core.views.uploads import FilesForm @@ -39,7 +40,7 @@ todo = """ - Refactor walletedit() as it contains all the wallets 'complaints' code from the pre-2022 script 'wallets.py' -- Need to validate uploaded file as being a valid image file, not a dubious script or hack +- We should validate uploaded file as being a valid image file, not a dubious script or hack? """ WALLET_BLANK_JSON = { "cave": "", @@ -851,10 +852,12 @@ def walletedit(request, path=None): else: svxothers = None trips = None + wallets = None else: svxothers = None trips = None + wallets = None # Survex and survex complaints, comes from json file on disc, not as pre-populated as above complaints, caveobject = get_complaints([], waldata, svxfiles, files, wallet, wurl)