diff options
Diffstat (limited to 'core/views/expo.py')
-rw-r--r-- | core/views/expo.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/views/expo.py b/core/views/expo.py index 1be813d..e051135 100644 --- a/core/views/expo.py +++ b/core/views/expo.py @@ -87,30 +87,30 @@ def expowebpage(request, expowebpath, path): if not Path(expowebpath / path).is_file(): return render(request, 'pagenotfound.html', {'path': path}) - with open(os.path.normpath(expowebpath / path), "rb") as o: + with open(os.path.normpath(expowebpath / path), "r") as o: html = o.read() - m = re.search(rb'(.*)<\s*head([^>]*)>(.*)<\s*/head\s*>(.*)<\s*body([^>]*)>(.*)<\s*/body\s*>(.*)', html, re.DOTALL + re.IGNORECASE) + 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() else: - return HttpResponse(default_head + html.decode() + '<h3>HTML Parsing failure:<br>Page could not be parsed into header and body:<br>failure detected in expowebpage in views.expo.py</h3> Please edit this <var>:expoweb:</var> page to be in the expected full HTML format </body' ) - m = re.search(rb"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE) + return HttpResponse(default_head + html + '<h3>HTML Parsing failure:<br>Page could not be parsed into header and body:<br>failure detected in expowebpage in views.expo.py</h3> Please edit this <var>:expoweb:</var> page to be in the expected full HTML format </body' ) + m = re.search(r"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE) if m: title, = m.groups() else: title = "" - m = re.search(rb"<meta([^>]*)noedit", head, re.DOTALL + re.IGNORECASE) + m = re.search(r"<meta([^>]*)noedit", head, re.DOTALL + re.IGNORECASE) if m: editable = False else: editable = True has_menu = False - menumatch = re.match(rb'(.*)<div id="menu">', body, re.DOTALL + re.IGNORECASE) + menumatch = re.match(r'(.*)<div id="menu">', body, re.DOTALL + re.IGNORECASE) if menumatch: has_menu = True - menumatch = re.match(rb'(.*)<ul id="links">', body, re.DOTALL + re.IGNORECASE) + menumatch = re.match(r'(.*)<ul id="links">', body, re.DOTALL + re.IGNORECASE) if menumatch: has_menu = True return render(request, 'flatpage.html', {'editable': editable, 'path': path, 'title': title, |