2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

regularising _URL and _ROOT idiom

This commit is contained in:
Philip Sargent 2022-04-18 22:48:49 +03:00
parent ccd386ff4e
commit 3813b21dcf
6 changed files with 11 additions and 9 deletions

View File

@ -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):

View File

@ -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)

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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"),