mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-15 11:27:10 +00:00
Attempt at append_slash, and backtrack.
This commit is contained in:
44
urls.py
44
urls.py
@@ -74,6 +74,8 @@ re_path( <regular expression that matches the thing in the web browser>,
|
||||
|
||||
Django also provides the reverse function: given an an object, provide the URL
|
||||
which is vital to writing code for the webapp. So the URL dispatch is declarative.
|
||||
But this means that two URLs should NOT go to the same python target function,
|
||||
(or only if the target name is different)
|
||||
|
||||
The API urls return TSV or JSON and are new in July 2020.
|
||||
"""
|
||||
@@ -101,16 +103,19 @@ todo = '''
|
||||
if settings.EXPOFILESREMOTE:
|
||||
expofilesurls = [
|
||||
path('<path:filepath>', expofiles_redirect, name="expofiles_redirect"), # to http://expo.survex.com/expofiles
|
||||
path('', expofiles_redirect, {'filepath': ""}, name="expofiles_redirect"),
|
||||
path('', expofiles_redirect, {'filepath': ""}, name="expofiles_redirect"), #should not have duplicate urls as reverse() then fails
|
||||
]
|
||||
else:
|
||||
expofilesurls = [
|
||||
path('', expofilessingle, {'filepath': ""}, name="single"),
|
||||
path('<path:filepath>', expofilessingle, name="single"), # local copy of EXPOFILES
|
||||
path('', expofilessingle, {'filepath': ""}, name="single"),
|
||||
path('<path:filepath>', expofilessingle, name="single"), # local copy of EXPOFILES, but should not have duplicate urls as reverse() then fails
|
||||
]
|
||||
|
||||
|
||||
trogglepatterns = [
|
||||
# NOT intercepted by apache. Needs to come first to prevent our troggle middleware trying to "fix" it.
|
||||
re_path(r'^site_media/(?P<subpath>.*)$', mediapage, {'doc_root': settings.MEDIA_ROOT}, name="mediapage"), # MEDIA_ROOT: CSS and JS
|
||||
|
||||
path('pubs.htm', pubspage, name="pubspage"), # ~165 hrefs to this url in expoweb files
|
||||
#path('', indexpage, name="indexpage"), # ~1,212 hrefs to this url in expoweb files
|
||||
path('index.htm', indexpage, name="indexpage"), # ~1,212 hrefs to this url in expoweb files
|
||||
@@ -118,7 +123,7 @@ trogglepatterns = [
|
||||
path('expofiles/', include(expofilesurls)), # intercepted by Apache, if it is running.
|
||||
path('expofiles', include(expofilesurls)), # curious interaction with the include() here, not just a slash problem.
|
||||
|
||||
re_path(r'^(.*)_edit_edit$', spider, name="spider"), # web spider funny
|
||||
re_path(r'^(.*)_edit_edit$', spider, name="spider"), # web spider. Intercept and manage it.
|
||||
|
||||
re_path(r'^caves$', caveindex, name="caveindex"),
|
||||
re_path(r'^indxal.htm$', caveindex, name="caveindex"), # ~420 hrefs to this url in expoweb files
|
||||
@@ -132,13 +137,13 @@ trogglepatterns = [
|
||||
path('admin/', admin.site.urls), # includes admin login & logout urls & /admin/jsi18n/
|
||||
|
||||
# Uploads - uploading a file
|
||||
path('walletedit/', walletedit, name='walletedit'),
|
||||
path('walletedit/<path:path>', walletedit, name='walletedit'), # path=2020#01
|
||||
path('walletedit/', walletedit, name='walletedit'), # not just an upload, also edit metadata
|
||||
path('walletedit/<path:path>', walletedit, name='walletedit'), # path=2020#01
|
||||
path('photoupload/', photoupload, name='photoupload'), # restricted to current year
|
||||
path('photoupload/<path:folder>', photoupload, name='photoupload'), # restricted to current year
|
||||
path('photoupload/<path:folder>', photoupload, name='photoupload'), # restricted to current year
|
||||
path('gpxupload/', gpxupload, name='gpxupload'), # restricted to current year
|
||||
path('gpxupload/<path:folder>', gpxupload, name='gpxupload'), # restricted to current year
|
||||
path('dwgupload/<path:folder>', dwgupload, name='dwgupload'),
|
||||
path('gpxupload/<path:folder>', gpxupload, name='gpxupload'), # restricted to current year
|
||||
path('dwgupload/<path:folder>', dwgupload, name='dwgupload'),
|
||||
path('dwgupload/', dwgupload, name='dwgupload'),
|
||||
path('dwguploadnogit/', dwgupload, {'gitdisable': 'yes'}, name='dwguploadnogit'), # used in testing
|
||||
path('dwguploadnogit/<path:folder>', dwgupload, {'gitdisable': 'yes'}, name='dwguploadnogit'), # used in testing
|
||||
@@ -195,7 +200,6 @@ trogglepatterns = [
|
||||
re_path(r'^logbook$', exportlogbook, name='exportlogbook'),
|
||||
path('logreport/<slug:year>', logreport, name='logreport'),
|
||||
path('logentrydelete/<slug:year>', logentrydelete, name='logentrydelete'),
|
||||
|
||||
|
||||
# Internal. editfile.html template uses these internally
|
||||
re_path(r'^getPeople/(?P<expeditionslug>.*)', get_people, name = "get_people"),
|
||||
@@ -210,17 +214,13 @@ trogglepatterns = [
|
||||
path('fix/<slug:areacode>', fix, name="fix"),
|
||||
re_path(r'^newcave/$', edit_cave, name="newcave"),
|
||||
re_path(r'^cave/3d/(?P<cave_id>[^/]+).3d$', cave3d, name="cave3d"),
|
||||
|
||||
#re_path(r'^cave/description/([^/]+)/?$', caves.caveDescription), #!!!BAD, local links fail..
|
||||
#re_path(r'^cave/(?P<cave_id>[^/]+)/?$', caves.cave, name="cave"), # used only in testing !? XXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
#re_path(r'^cave/(?P<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent), #!!!BAD, local links fail..# view_caves.ent
|
||||
|
||||
# Edit caves and entrances
|
||||
re_path(r'^(?P<path>.*)/(?P<slug>[^/]+)_cave_edit/$', edit_cave, name="edit_cave"), # edit_cave needed by cave.html template for url matching
|
||||
re_path(r'^(?P<caveslug>[^/]+):(?P<entslug>[^:]+)_entrance_edit', edit_entrance, name = "editentrance"), #edit existing entrance
|
||||
re_path(r'^(?P<path>.*)/(?P<caveslug>[^/]+)_entrance_new$', edit_entrance, name = "newentrance"), # new entrance for a cave
|
||||
|
||||
re_path(r'^(.*)_edit$', editexpopage, name="editexpopage"),
|
||||
re_path(r'^(.*)_edit$', editexpopage, name="editexpopage"), # only happens if not a cave or entrance _edit page
|
||||
re_path(r'^(?P<karea>162\d)(?P<subpath>.*)$', cavepage, name="cavepage"), # shorthand /1623/264 or 1623/161/top.htm or 1623/161/i/stuff.jpg
|
||||
# Note that urls eg '/1623/161/l/rl89a.htm' are handled by cavepage which redirects them to 'expopage'
|
||||
# Note that _edit$ for a cave description page in a subfolder e.g. /1623/204/204.html_edit gets caught here and breaks with 404
|
||||
@@ -265,20 +265,16 @@ trogglepatterns = [
|
||||
path('survexfilewild/', statistics.svxfilewild, name="svxfilewild"),
|
||||
path('survexfilewild/<int:year>', statistics.svxfilewild, name="svxfilewild"),
|
||||
|
||||
|
||||
# The survey scans in the wallets. This short-cuts SCANS_URL which is not used anymore and is defunct
|
||||
path('survey_scans/', allscans, name="allscans"), # all the scans in all wallets
|
||||
path('survey_scans/<path:path>/', walletedit, name="singlewallet"), # replaced singlewallet()
|
||||
path('survey_scans/<path:path>/<file>', scansingle, name="scansingle"), # works, but html href goes direct to /expofiles/ too
|
||||
path('cave/scans/<slug:caveid>', cavewallets, name="cavewallets"), # like allscans, but for just one cave
|
||||
|
||||
# The data about the wallets themselves, not the scans inside tehm
|
||||
# The data about the wallets themselves, not the scans inside them
|
||||
path('wallets/year/<int:year>', walletslistyear, name="walletslistyear"), # wallets that are for a specific year, as an integer '1985'
|
||||
# re_path('wallets/person/(?P<first_name>[A-Z]*[a-z\-\'&;]*)[^a-zA-Z]*(?P<last_name>[a-z\-\']*[^a-zA-Z]*[\-]*[A-Z]*[a-zA-Z\-&;]*)/?', walletslistperson, name="walletslistperson"),
|
||||
path('wallets/person/<slug:slug>', walletslistperson, name="walletslistperson"),
|
||||
|
||||
|
||||
|
||||
# The tunnel and therion drawings files pageswalletslistcave
|
||||
path('drawings', dwgallfiles, name="dwgallfiles"),
|
||||
path('drawings/', dwgallfiles, name="dwgallfiles"),
|
||||
@@ -308,12 +304,6 @@ trogglepatterns = [
|
||||
path('javascript/<path:subpath>', mediapage, {'doc_root': settings.JSLIB_ROOT}, name="mediapage"), # JSLIB_URL
|
||||
|
||||
|
||||
# NOT intercepted by apache
|
||||
re_path(r'^site_media/(?P<subpath>.*)$', mediapage, {'doc_root': settings.MEDIA_ROOT}, name="mediapage"), # MEDIA_ROOT: CSS and JS
|
||||
|
||||
# Fossil ? /loser/caves-1623/171/171.svx fails 404, /loser/docs/smklengths fails 404
|
||||
re_path(r'^/loser/(?P<subpath>.*)$', mediapage, {'doc_root': settings.SURVEX_DATA}, name="mediapage"), # Oddly not working !?
|
||||
|
||||
|
||||
# Helpers to edit HTML
|
||||
re_path(r'^image_selector/(?P<path>.*)', image_selector, name = 'image_selector'),
|
||||
@@ -323,6 +313,8 @@ trogglepatterns = [
|
||||
re_path(r'^expo.kmz', expo_kmz, name = 'expo.kmz'),
|
||||
|
||||
# Final catchall which also serves expoweb handbook pages and imagestiny
|
||||
# but a universal catchall also prevents the djang standard append_slash working, as every string resolves.
|
||||
# try to fix in troggle/middleware.py
|
||||
re_path(r'^(.*)$', expopage, name="expopage"), # CATCHALL assumed relative to EXPOWEB
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user