2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-01-19 09:22:32 +00:00

bug fix to setting encoding

This commit is contained in:
Martin Green 2022-06-20 21:38:46 +01:00
parent a664e8ce8c
commit 3420422f29

View File

@ -282,8 +282,8 @@ def editexpopage(request, path):
try:
filepath = Path(settings.EXPOWEB) / path
o = open(os.path.normpath(filepath).encode(sysdefaultencoding), "r")
html = o.read(encoding="utf8")
o = open(os.path.normpath(filepath).encode(sysdefaultencoding), "r", encoding="utf8")
html = o.read()
autogeneratedmatch = re.search(r"\<\!--\s*(.*?(Do not edit|It is auto-generated).*?)\s*--\>", html, re.DOTALL + re.IGNORECASE)
if autogeneratedmatch:
return HttpResponse(autogeneratedmatch.group(1))