diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2021-04-28 00:48:20 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2021-04-28 00:48:20 +0100 |
commit | b9fad1f4fb0fd496aedfcb439709f308cd366de8 (patch) | |
tree | 34c9fab88b32c30328c6c17174e0df3326e73f50 /urls.py | |
parent | 5e478c7eb0a2bcd23ca46d1c4bd200750fbc9231 (diff) | |
download | troggle-b9fad1f4fb0fd496aedfcb439709f308cd366de8.tar.gz troggle-b9fad1f4fb0fd496aedfcb439709f308cd366de8.tar.bz2 troggle-b9fad1f4fb0fd496aedfcb439709f308cd366de8.zip |
new path() interacts badly with include(). fixed
Diffstat (limited to 'urls.py')
-rw-r--r-- | urls.py | 46 |
1 files changed, 27 insertions, 19 deletions
@@ -47,12 +47,14 @@ todo = '''Replace most re_path() with modern and simpler path() if settings.EXPOFILESREMOTE: expofilesurls = [ - re_path(r'^(?P<path>.*)$', expofiles_redirect, name="expofiles_redirect"), # to http://expo.survex.com/expofiles - ] + path('/<path:filepath>', expofiles_redirect, name="expofiles_redirect"), # to http://expo.survex.com/expofiles + path('', expofiles_redirect, {'filepath': ""}, name="expofiles_redirect"), + ] else: expofilesurls = [ - re_path(r'^(?P<filepath>.*)$', expofilessingle, name="single"), # local copy of EXPOFILES - ] + path('/<path:filepath>', expofilessingle, name="single"), # local copy of EXPOFILES + path('', expofilessingle, {'filepath': ""}, name="single"), + ] # The URLs provided by include('django.contrib.auth.urls') are: @@ -66,7 +68,8 @@ else: # accounts/reset/done/ [name='password_reset_complete'] trogglepatterns = [ - re_path(r'^expofiles/', include(expofilesurls)), + path('expofiles/', include(expofilesurls)), + path('expofiles', include(expofilesurls)), # curious interaction with the include() here, not just a slash problem. re_path(r'^caves$', caves.caveindex, name="caveindex"), re_path(r'^indxal.htm$', caves.caveindex, name="caveindex"), # ~420 hrefs to this url in expoweb files @@ -105,14 +108,14 @@ trogglepatterns = [ re_path(r'^getEntrances/(?P<caveslug>.*)', caves.get_entrances, name = "get_entrances"), # Cave description pages - re_path(r'^cave/new/$', caves.edit_cave, name="newcave"), + re_path(r'^newcave/$', caves.edit_cave, name="newcave"), re_path(r'^cave/3d/(?P<cave_id>[^/]+)$', caves.cave3d, name="cave3d"), - re_path(r'^cave/(?P<cave_id>[^/]+)/?$', caves.cave, name="cave"), - re_path(r'^cave/(?P<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent), # view_caves.ent - re_path(r'^cave/(?P<slug>[^/]+)/edit/$', caves.edit_cave, name="edit_cave"), re_path(r'^cave/entrance/([^/]+)/?$', caves.caveEntrance), re_path(r'^cave/description/([^/]+)/?$', caves.caveDescription), + re_path(r'^cave/(?P<cave_id>[^/]+)/?$', caves.cave, name="cave"), + re_path(r'^cave/(?P<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent), # view_caves.ent + re_path(r'^cave/(?P<slug>[^/]+)/edit/$', caves.edit_cave, name="edit_cave"), re_path(r'^(?P<karea>\d\d\d\d)(?P<subpath>.*)$', cavepage, name="cavepage"), # shorthand /1623/264 BUT url links may break # Note that urls eg '1623/161/l/rl89a.htm' are handled by cavepage which redirects them to 'expopage' @@ -126,23 +129,26 @@ trogglepatterns = [ path('pathsreport', statistics.pathsreport, name="pathsreport"), path('dataissues', statistics.dataissues, name="dataissues"), - re_path(r'^troggle$', frontpage, name="frontpage"), # control panel. Shows recent actions. - re_path(r'^todo/(?P<module>.*)$', todos, name="todos"), - re_path(r'^controlpanel/?$', controlpanel, name="controlpanel"), + path(r'troggle', frontpage, name="frontpage"), # control panel. Shows recent actions. + path(r'todo/<path:module>', todos, name="todos"), + path(r'controlpanel', controlpanel, name="controlpanel"), # The survexfile pages + path('survexfile', survex.survexcavesingle, {'survex_cave': ''}, name="survexcavessingle"), + path('survexfile/', survex.survexcavesingle, {'survex_cave': ''}, name="survexcavessingle"), + path('survexfile/caves', survex.survexcaveslist, name="survexcaveslist"), + path('survexfile/caves/', survex.survexcaveslist, name="survexcaveslist"), # auto slash not working + path('survexfile/<path:survex_file>.svx', survex.svx, name="svx"), path('survexfile/<path:survex_file>.3d', survex.threed, name="threed"), path('survexfile/<path:survex_file>.log', survex.svxraw, name="svxraw"), path('survexfile/<path:survex_file>.err', survex.err, name="err"), + path('survexfile/<path:survex_cave>', survex.survexcavesingle, name="survexcavessingle"), - path('survexfile/caves', survex.survexcaveslist, name="survexcaveslist"), - path('survexfile/caves/', survex.survexcaveslist, name="survexcaveslist"), # auto slash not working - path('survexfile/<survex_cave>', survex.survexcavesingle, name="survexcavessingle"), - - path('survey_scans/', allwallets, name="allwallets"), - path('survey_scans/<path>/', singlewallet, name="singlewallet"), +# The survey scans in the wallets + path('survey_scans/', allwallets, name="allwallets"), + path('survey_scans/<path>/', singlewallet, name="singlewallet"), path('survey_scans/<path>/<file>', scansingle, name="scansingle"), # The tunnel and therion drawings files pages @@ -154,7 +160,7 @@ trogglepatterns = [ re_path(r'^dwgdataraw/(?P<path>.+?\.xml)/upload$', dwgfileupload, name="dwgfileupload"), # Not working -# QMs pages - must precede other /caves pages +# QMs pages - must precede other /caves pages? re_path(r'^cave/qms/([^/]+)/?$', caves.caveQMs), # Broken- QMs have no proper link to cave id re_path(r'^cave/(?P<cave_id>[^/]+)/(?P<year>\d\d\d\d)-(?P<qm_id>\d*)(?P<grade>[ABCDX]?)?$', caves.qm, name="qm"), @@ -168,6 +174,8 @@ trogglepatterns = [ re_path(r'^static/(?P<subpath>.*)$', mediapage, {'doc_root': settings.MEDIA_ROOT}, name="mediapage"), # STATIC is in MEDIA now! re_path(r'^javascript/(?P<subpath>.*)$', mediapage, {'doc_root': settings.JSLIB_ROOT}, name="mediapage"), # JSLIB_URL re_path(r'^expowebcache/3d/(?P<subpath>.*)$', mediapage, {'doc_root': settings.THREEDCACHEDIR}, name="mediapage"), + + re_path(r'^/loser/(?P<subpath>.*)$', mediapage, {'doc_root': settings.SURVEX_DATA}, name="mediapage"), # Oddly not working !? re_path(r'^map/map.html', map, name="map"), # Redirects to OpenStreetMap JavaScript re_path(r'^map/(?P<path>.*)$', mapfile, name="mapfile"), # css, js, gpx |