From 9b9f6720e079669fd884d83f6b69833e20d03ff7 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Mon, 3 May 2021 20:35:35 +0100 Subject: not found now does 404 & moved login --- core/views/expo.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'core/views/expo.py') diff --git a/core/views/expo.py b/core/views/expo.py index 9ff533b..57d1a7d 100644 --- a/core/views/expo.py +++ b/core/views/expo.py @@ -14,7 +14,7 @@ from django.contrib import admin import django.forms as forms -from .login import login_required_if_public +from .auth import login_required_if_public from troggle.core.models.caves import Cave import troggle.core.views.caves import troggle.settings as settings @@ -121,7 +121,7 @@ def expowebpage(request, expowebpath, path): '''Adds menus and serves an HTML page ''' if not Path(expowebpath / path).is_file(): - return render(request, 'pagenotfound.html', {'path': path}) + return render(request, 'pagenotfound.html', {'path': path}, status="404") with open(os.path.normpath(expowebpath / path), "r") as o: html = o.read() @@ -164,9 +164,9 @@ def mediapage(request, subpath=None, doc_root=None): try: return HttpResponse(content=open(filetobeopened, "rb"), content_type=getmimetype(subpath)) except IOError: - return render(request, 'pagenotfound.html', {'path': subpath}) + return render(request, 'pagenotfound.html', {'path': subpath}, status="404") else: - return render(request, 'pagenotfound.html', {'path': subpath}) + return render(request, 'pagenotfound.html', {'path': subpath}, status="404") @@ -196,7 +196,7 @@ def expopage(request, path): if (expowebpath / path / p).is_file(): # This needs to reset the path to the new subdirectory return HttpResponseRedirect('/'+str(Path(path) / p)) - return render(request, 'pagenotfound.html', {'path': Path(path) / "index.html"}) + return render(request, 'pagenotfound.html', {'path': Path(path) / "index.html"}, status="404") if path.endswith("/"): # we already know it is not a directory. @@ -210,7 +210,7 @@ def expopage(request, path): try: return HttpResponse(content=open(filetobeopened, "rb"), content_type=getmimetype(path)) except IOError: - return render(request, 'pagenotfound.html', {'path': path}) + return render(request, 'pagenotfound.html', {'path': path}, status="404") @@ -310,7 +310,7 @@ def editexpopage(request, path): git = settings.GIT with open(filepath, "w") as f: f.write(result) - print(f'WROTE {cwd}---{filename} ') + #print(f'WROTE {cwd}---{filename} ') subprocess.call([git, "add", filename], cwd=cwd) subprocess.call([git, "commit", "-m", 'Edit this page'], cwd=cwd) -- cgit v1.2.3