2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 12:27:05 +00:00

fixing bugs after wookey session

This commit is contained in:
Philip Sargent
2022-03-22 02:22:15 +00:00
parent 48171ae824
commit f1b206ad34
8 changed files with 41 additions and 57 deletions

View File

@@ -125,9 +125,12 @@ def expowebpage(request, expowebpath, path):
print(f' - 404 error in expowebpage() {path}')
return render(request, 'pagenotfound.html', {'path': path}, status="404")
with open(os.path.normpath(expowebpath / path), "r") as o:
html = o.read()
try:
with open(os.path.normpath(expowebpath / path), "r") as o:
html = o.read()
except:
return HttpResponse(default_head + html + '<h3>UTF-8 Parsing Failue:<br>Page could not be parsed using UTF-8:<br>failure detected in expowebpage in views.expo.py</h3> Please edit this <var>:expoweb:</var> page to replace dubious umlauts with HTML entitiies in the expected code. </body' )
m = re.search(r'(.*)<\s*head([^>]*)>(.*)<\s*/head\s*>(.*)<\s*body([^>]*)>(.*)<\s*/body\s*>(.*)', html, re.DOTALL + re.IGNORECASE)
if m:
preheader, headerattrs, head, postheader, bodyattrs, body, postbody = m.groups()