summaryrefslogtreecommitdiffstats
path: root/core/views/expo.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-03-22 02:22:15 +0000
committerPhilip Sargent <philip.sargent@klebos.com>2022-03-22 02:22:15 +0000
commitf1b206ad34ab06772d648ced3ae0995538e26dd6 (patch)
treef0b0b2228dda793473dd5bc693c7b795f9136cc0 /core/views/expo.py
parent48171ae824bed1ebae764916c8da4f529455f28e (diff)
downloadtroggle-f1b206ad34ab06772d648ced3ae0995538e26dd6.tar.gz
troggle-f1b206ad34ab06772d648ced3ae0995538e26dd6.tar.bz2
troggle-f1b206ad34ab06772d648ced3ae0995538e26dd6.zip
fixing bugs after wookey session
Diffstat (limited to 'core/views/expo.py')
-rw-r--r--core/views/expo.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/views/expo.py b/core/views/expo.py
index c6ef01b..b6644f3 100644
--- a/core/views/expo.py
+++ b/core/views/expo.py
@@ -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()