summaryrefslogtreecommitdiffstats
path: root/core/views/expo.py
diff options
context:
space:
mode:
authorMartin Green <martin.speleo@gmail.com>2022-06-22 09:10:56 +0100
committerMartin Green <martin.speleo@gmail.com>2022-06-22 09:10:56 +0100
commit4d8125a2fdb7ec66bc7e4a5d277d04fbbb7ff353 (patch)
tree470b2c590c4a00b3ce3e70b31b0990b67c28ca81 /core/views/expo.py
parentea880915b0eb728e0d666a828ffa360c6d59c200 (diff)
downloadtroggle-4d8125a2fdb7ec66bc7e4a5d277d04fbbb7ff353.tar.gz
troggle-4d8125a2fdb7ec66bc7e4a5d277d04fbbb7ff353.tar.bz2
troggle-4d8125a2fdb7ec66bc7e4a5d277d04fbbb7ff353.zip
removed rest of endocings
Diffstat (limited to 'core/views/expo.py')
-rw-r--r--core/views/expo.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/views/expo.py b/core/views/expo.py
index 885eafd..66dffd0 100644
--- a/core/views/expo.py
+++ b/core/views/expo.py
@@ -121,19 +121,19 @@ def expofilesdir(request, dirpath, filepath):
def expowebpage(request, expowebpath, path):
'''Adds menus and serves an HTML page
'''
- if not os.path.isfile(os.path.normpath(expowebpath / path).encode(sysdefaultencoding)):
+ if not os.path.isfile(expowebpath / path):
# Should not get here if the path has suffix "_edit"
print(f' - 404 error in expowebpage() {path}')
return render(request, 'pagenotfound.html', {'path': path}, status="404")
try:
- with open(os.path.normpath(expowebpath / path).encode(sysdefaultencoding), "r", encoding='utf-8') as o:
+ with open(expowebpath / path, "r", encoding='utf-8') as o:
html = o.read()
except:
# exception raised on debian with python 3.9.2 but not on WSL Ubuntu with python 3.9.5
# because debian was assuming default text encoding was 'ascii'. Now specified explicitly so should be OK
try:
- with open(os.path.normpath(expowebpath / path).encode(sysdefaultencoding), "rb") as o:
+ with open(expowebpath / path, "rb") as o:
html = str(o.read()).replace("<h1>","<h1>BAD NON-UTF-8 characters here - ")
html = html.replace("\\n","\n")
html = html.replace("\\r","")
@@ -156,7 +156,7 @@ def expowebpage(request, expowebpath, path):
if m:
editable = False
else:
- editable = os.access(os.path.normpath(expowebpath / path).encode(sysdefaultencoding), os.W_OK) # are file permissions writeable?
+ editable = os.access(expowebpath / path, os.W_OK) # are file permissions writeable?
has_menu = False
menumatch = re.match(r'(.*)<div id="menu">', body, re.DOTALL + re.IGNORECASE)