summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-04-18 22:48:49 +0300
committerPhilip Sargent <philip.sargent@klebos.com>2022-04-18 22:48:49 +0300
commit3813b21dcf5fbec27f5a5d05deca5d302d4e1637 (patch)
treee0f236649bfae88a666099d6eecdfb4d734b751b
parentccd386ff4e2ed974c61b2f5503bce837fa0c2523 (diff)
downloadtroggle-3813b21dcf5fbec27f5a5d05deca5d302d4e1637.tar.gz
troggle-3813b21dcf5fbec27f5a5d05deca5d302d4e1637.tar.bz2
troggle-3813b21dcf5fbec27f5a5d05deca5d302d4e1637.zip
regularising _URL and _ROOT idiom
-rw-r--r--core/TESTS/tests_logins.py2
-rw-r--r--core/views/statistics.py8
-rw-r--r--core/views/uploads.py2
-rw-r--r--deprecations.txt2
-rw-r--r--parsers/scans.py4
-rw-r--r--urls.py2
6 files changed, 11 insertions, 9 deletions
diff --git a/core/TESTS/tests_logins.py b/core/TESTS/tests_logins.py
index 5998881..513e69d 100644
--- a/core/TESTS/tests_logins.py
+++ b/core/TESTS/tests_logins.py
@@ -105,7 +105,7 @@ class PostTests(TestCase):
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
# Does not use the filename Django actually uses, assumes it is unchanged. Potential bug.
- remove_file = pathlib.Path(settings.SURVEY_SCANS) / '2020' / '2020#00'/ 'test_upload_file.txt'
+ remove_file = pathlib.Path(settings.SCANS_ROOT) / '2020' / '2020#00'/ 'test_upload_file.txt'
remove_file.unlink()
def test_photo_upload(self):
diff --git a/core/views/statistics.py b/core/views/statistics.py
index bd1d065..02cbd43 100644
--- a/core/views/statistics.py
+++ b/core/views/statistics.py
@@ -49,9 +49,9 @@ def pathsreport(request):
"ROOT_URLCONF" : str( settings.ROOT_URLCONF),
"STATIC_URL" : str( settings.STATIC_URL),
"SURVEX_DATA" : str( settings.SURVEX_DATA),
- "SURVEY_SCANS" : str( settings.SURVEY_SCANS),
+ "SCANS_ROOT" : str( settings.SCANS_ROOT),
# "SURVEYS" : str( settings.SURVEYS),
- "SURVEYS_URL" : str( settings.SURVEYS_URL),
+ "SCANS_URL" : str( settings.SCANS_URL),
"SURVEXPORT" : str( settings.SURVEXPORT),
"DRAWINGS_DATA" : str( settings.DRAWINGS_DATA),
"URL_ROOT" : str( settings.URL_ROOT)
@@ -86,9 +86,9 @@ def pathsreport(request):
"ROOT_URLCONF" : type(settings.ROOT_URLCONF),
"STATIC_URL" : type(settings.STATIC_URL),
"SURVEX_DATA" : type(settings.SURVEX_DATA),
- "SURVEY_SCANS" : type(settings.SURVEY_SCANS),
+ "SCANS_ROOT" : type(settings.SCANS_ROOT),
# "SURVEYS" : type(settings.SURVEYS),
- "SURVEYS_URL" : type(settings.SURVEYS_URL),
+ "SCANS_URL" : type(settings.SCANS_URL),
"SURVEXPORT" : type(settings.SURVEXPORT),
"DRAWINGS_DATA" : type(settings.DRAWINGS_DATA),
"URL_ROOT" : type(settings.URL_ROOT)
diff --git a/core/views/uploads.py b/core/views/uploads.py
index 255b2b6..1d0a510 100644
--- a/core/views/uploads.py
+++ b/core/views/uploads.py
@@ -141,7 +141,7 @@ def scanupload(request, path=None):
wurl = f"/scanupload/{wallet}".replace('#', ':')
wallet = wallet.replace(':','#')
- dirpath = Path(settings.SURVEY_SCANS, year, wallet)
+ dirpath = Path(settings.SCANS_ROOT, year, wallet)
contents_path = dirpath / contentsjson
walletdata = dirpath / contentsjson
diff --git a/deprecations.txt b/deprecations.txt
index e69de29..a8f4ed8 100644
--- a/deprecations.txt
+++ b/deprecations.txt
@@ -0,0 +1,2 @@
+/mnt/d/EXPO/troggle/core/views/uploads.py:120: DeprecationWarning: invalid escape sequence \d
+ if not re.match('(19|20)\d\d[:#]\d\d', wallet):
diff --git a/parsers/scans.py b/parsers/scans.py
index 7868c70..d2fcbf7 100644
--- a/parsers/scans.py
+++ b/parsers/scans.py
@@ -111,7 +111,7 @@ def load_all_scans():
DataIssue.objects.filter(parser='scans').delete()
# first do the smkhs (large kh survey scans) directory
- manywallets_smkhs = Wallet(fpath=os.path.join(settings.SURVEY_SCANS, "../surveys/smkhs"), walletname="smkhs")
+ manywallets_smkhs = Wallet(fpath=os.path.join(settings.SCANS_ROOT, "../surveys/smkhs"), walletname="smkhs")
print("smkhs", end=' ')
if os.path.isdir(manywallets_smkhs.fpath):
manywallets_smkhs.save()
@@ -120,7 +120,7 @@ def load_all_scans():
# iterate into the surveyscans directory
print(' - ', end=' ')
- for f, ff, fisdir in GetListDir(settings.SURVEY_SCANS):
+ for f, ff, fisdir in GetListDir(settings.SCANS_ROOT):
if not fisdir:
continue
diff --git a/urls.py b/urls.py
index eac48ba..3a8c0cf 100644
--- a/urls.py
+++ b/urls.py
@@ -163,7 +163,7 @@ trogglepatterns = [
path('survexfile/<path:survex_cave>', survex.survexcavesingle, name="survexcavessingle"),
-# The survey scans in the wallets
+# The survey scans in the wallets. This short-cuts SCANS_URL which is not actually used anywhere!
path('survey_scans/', allwallets, name="allwallets"),
path('survey_scans/<path:path>/', scanupload, name="singlewallet"), # replaced singlewallet()
path('survey_scans/<path:path>/<file>', scansingle, name="scansingle"),