summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/views/expo.py26
-rw-r--r--urls.py5
2 files changed, 27 insertions, 4 deletions
diff --git a/core/views/expo.py b/core/views/expo.py
index 3e75e5e..d0f504d 100644
--- a/core/views/expo.py
+++ b/core/views/expo.py
@@ -14,7 +14,7 @@ from django.views.decorators.csrf import ensure_csrf_cookie
import troggle.core.views.caves
import troggle.settings as settings
from troggle.core.models.caves import Cave
-from troggle.core.utils import WriteAndCommitError, write_and_commit
+from troggle.core.utils import WriteAndCommitError, write_and_commit, current_expo
from troggle.core.views.editor_helpers import HTMLarea
from troggle.core.views.uploads import edittxtpage
@@ -132,7 +132,27 @@ def expofilesdir(request, dirpath, filepath):
{"filepath": urlpath, "fileitems": fileitems, "diritems": diritems, "settings": settings},
)
-
+def pubspage(request):
+ """This is a single-page function, specifically to cope with the updated "current year"
+ which is hard-coded into the HTML of the page.
+ This is a placeholder, we need to do something like what is done in indexpage() below...
+ """
+ expowebpath = Path(settings.EXPOWEB)
+ return expowebpage(request, expowebpath, "pubs.htm")
+
+def indexpage(request):
+ """This is a single-page function, specifically to cope with the updated "current year"
+ which is hard-coded into the HTML of the page.
+ This edits the most recent year on the fly..
+ This now works.
+ """
+ subpath = Path(settings.EXPOWEB) / "index00.htm"
+ with open(subpath, "r") as o:
+ html = o.read()
+ html = html.replace('2xxx', f"{current_expo()}")
+ content_type = "text/html"
+ return HttpResponse(html, content_type=content_type)
+
def expowebpage(request, expowebpath, path):
"""Adds menus and serves an HTML page"""
if not os.path.isfile(expowebpath / path):
@@ -236,7 +256,7 @@ def mediapage(request, subpath=None, doc_root=None):
"""This is for special prefix paths /photos/ /site_media/, /static/ etc.
as defined in urls.py . If given a directory, gives a failure page.
"""
- # print(" - XXXXX_ROOT: {} ...{}".format(doc_root, subpath))
+ print("mediapath", subpath)
if doc_root is not None:
filetobeopened = Path(doc_root, subpath)
if filetobeopened.is_dir():
diff --git a/urls.py b/urls.py
index f75975b..24b0cf2 100644
--- a/urls.py
+++ b/urls.py
@@ -11,7 +11,7 @@ from troggle.core.views.caves import (cave3d, caveindex, entranceindex, caveslis
edit_entrance, get_entrances, qm, expo_kml, expo_kmz)
from troggle.core.views.drawings import dwgallfiles, dwgfilesingle
from troggle.core.views.editor_helpers import image_selector, new_image_form
-from troggle.core.views.expo import (editexpopage, expofiles_redirect,
+from troggle.core.views.expo import (pubspage, indexpage, editexpopage, expofiles_redirect,
expofilessingle, expopage, map, mapfile,
mediapage, spider)
from troggle.core.views.logbooks import (QMs_jsonListView, Expeditions_jsonListView,
@@ -91,6 +91,9 @@ else:
# /home/philip/p11d5/lib/python3.11/site-packages/django/contrib/admin/sites.py
trogglepatterns = [
+ path('pubs.htm', pubspage, name="pubspage"), # ~165 hrefs to this url in expoweb files
+ path('index.htm', indexpage, name="indexpage"), # ~1,212 hrefs to this url in expoweb files
+
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.