diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2021-05-03 20:35:35 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2021-05-03 20:35:35 +0100 |
commit | 9b9f6720e079669fd884d83f6b69833e20d03ff7 (patch) | |
tree | 9f54c736d5e1514a03018dd1e9dcbd720d00fc16 /core/views/expo.py | |
parent | 254b465755f7ebfc1650730ac2d51bb33543a85c (diff) | |
download | troggle-9b9f6720e079669fd884d83f6b69833e20d03ff7.tar.gz troggle-9b9f6720e079669fd884d83f6b69833e20d03ff7.tar.bz2 troggle-9b9f6720e079669fd884d83f6b69833e20d03ff7.zip |
not found now does 404 & moved login
Diffstat (limited to 'core/views/expo.py')
-rw-r--r-- | core/views/expo.py | 14 |
1 files changed, 7 insertions, 7 deletions
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) |