mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 05:27:12 +00:00
still working on tests
This commit is contained in:
@@ -133,7 +133,7 @@ def expowebpage(request, expowebpath, path):
|
||||
if not os.path.isfile(expowebpath / path):
|
||||
# Should not get here if the path has suffix "_edit"
|
||||
print(f" - 404 error in expowebpage() {path}")
|
||||
return render(request, "pagenotfound.html", {"path": path}, status="404")
|
||||
return render(request, "pagenotfound.html", {"path": path}, status=404)
|
||||
|
||||
# print(f' - {sys_getfilesystemencoding()=}')
|
||||
if sys_getfilesystemencoding() != "utf-8":
|
||||
@@ -239,9 +239,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}, status="404")
|
||||
return render(request, "pagenotfound.html", {"path": subpath}, status=404)
|
||||
else:
|
||||
return render(request, "pagenotfound.html", {"path": subpath}, status="404")
|
||||
return render(request, "pagenotfound.html", {"path": subpath}, status=404)
|
||||
|
||||
|
||||
def expopage(request, path):
|
||||
@@ -270,7 +270,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"}, status="404")
|
||||
return render(request, "pagenotfound.html", {"path": Path(path) / "index.html"}, status=404)
|
||||
|
||||
if path.endswith("/"):
|
||||
# we already know it is not a directory.
|
||||
@@ -293,7 +293,7 @@ def expopage(request, path):
|
||||
content_type = getmimetype(path)
|
||||
return HttpResponse(content=content, content_type=content_type)
|
||||
except IOError:
|
||||
return render(request, "pagenotfound.html", {"path": path}, status="404")
|
||||
return render(request, "pagenotfound.html", {"path": path}, status=404)
|
||||
|
||||
|
||||
def getmimetype(path):
|
||||
|
||||
Reference in New Issue
Block a user