summaryrefslogtreecommitdiffstats
path: root/core/views/expo.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2024-07-08 20:22:42 +0200
committerPhilip Sargent <philip.sargent@gmail.com>2024-07-08 20:22:42 +0200
commita68ef2728409860ad4325660213e2beca94e8a78 (patch)
tree46d019dcef489c4d1a08a72df2719a69758bd8ab /core/views/expo.py
parent35e6bbe1acb7aead34b1f40cbe9c4dbd524ee57b (diff)
downloadtroggle-a68ef2728409860ad4325660213e2beca94e8a78.tar.gz
troggle-a68ef2728409860ad4325660213e2beca94e8a78.tar.bz2
troggle-a68ef2728409860ad4325660213e2beca94e8a78.zip
make some pages sensitive to current_expo()
Diffstat (limited to 'core/views/expo.py')
-rw-r--r--core/views/expo.py26
1 files changed, 23 insertions, 3 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():