mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-03-01 03:01:41 +00:00
reformat 404 message
This commit is contained in:
@@ -333,18 +333,20 @@ def expopage(request, path):
|
||||
+ "<h3>UTF-8 Parsing Failure:<br>Default file encoding on this Troggle installation is not UTF-8:<br>failure detected in expowebpage in views.expo.py</h3> Please Please reconfigure Debian/Apache/Django to fix this, i.e. contact Wookey. </body"
|
||||
)
|
||||
|
||||
meta = request.META
|
||||
try:
|
||||
content = open(filetobeopened, "rb")
|
||||
content_type = getmimetype(path)
|
||||
return HttpResponse(content=content, content_type=content_type)
|
||||
except Exception as e:
|
||||
meta = request.META
|
||||
message = f" ! - 404 '{e}' '{path=}' {meta['REMOTE_ADDR']=} "
|
||||
#{request.META['REMOTE_ADDR']} {request.META['REMOTE_HOST']} {request.META['REMOTE_USER']} {request.META['HTTP_USER_AGENT']} "
|
||||
#print(message)
|
||||
except FileNotFoundError as e:
|
||||
message = f" ! - 404 FileNotFound REMOTE_ADDR: {meta['REMOTE_ADDR']}' /{path}'"
|
||||
DataIssue.objects.create(parser="view404", message=message)
|
||||
|
||||
return render(request, "pagenotfound.html", {"path": path}, status=404)
|
||||
except Exception as e:
|
||||
message = f" ! - 404? REMOTE_ADDR: {meta['REMOTE_ADDR']}' /{path}' {e}"
|
||||
DataIssue.objects.create(parser="view404", message=message)
|
||||
return render(request, "pagenotfound.html", {"path": path}, status=404)
|
||||
|
||||
|
||||
|
||||
def getmimetype(path):
|
||||
|
||||
Reference in New Issue
Block a user