diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2021-04-06 22:50:57 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2021-04-06 22:50:57 +0100 |
commit | 785d6360cd97175da954decb1fad26a0098ce7a5 (patch) | |
tree | d4fef8618525dac830a49fe2030ca05002daf247 /core/views/expo.py | |
parent | 05ed8af158cb6b15a596a9726e78bc556bd1943f (diff) | |
download | troggle-785d6360cd97175da954decb1fad26a0098ce7a5.tar.gz troggle-785d6360cd97175da954decb1fad26a0098ce7a5.tar.bz2 troggle-785d6360cd97175da954decb1fad26a0098ce7a5.zip |
Now compat with Dj2.0.13 & 1.11.29
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, |