2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-03-30 07:39:50 +01:00

add timestampt

This commit is contained in:
2026-02-10 19:13:14 +00:00
parent 9a47648e4a
commit 177047127c

View File

@@ -1,5 +1,6 @@
import os
import re
from datetime import datetime
from pathlib import Path
from sys import getfilesystemencoding as sys_getfilesystemencoding
from urllib.parse import unquote as urlunquote
@@ -334,16 +335,17 @@ def expopage(request, path):
)
meta = request.META
stamp = datetime.now().isoformat(sep=' ', timespec='seconds')
try:
content = open(filetobeopened, "rb")
content_type = getmimetype(path)
return HttpResponse(content=content, content_type=content_type)
except FileNotFoundError as e:
message = f" ! - 404 FileNotFound REMOTE_ADDR: {meta['REMOTE_ADDR']}' /{path}'"
message = f" ! - 404 FileNotFound REMOTE_ADDR: {meta['REMOTE_ADDR']} [{stamp}] '/{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']:>15}' /{path}' {e}"
message = f" ! - 404? REMOTE_ADDR: {meta['REMOTE_ADDR']:>15} [{stamp}] '/{path}' {e}"
DataIssue.objects.create(parser="view404", message=message)
return render(request, "pagenotfound.html", {"path": path}, status=404)