summaryrefslogtreecommitdiffstats
path: root/flatpages/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'flatpages/views.py')
-rw-r--r--flatpages/views.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/flatpages/views.py b/flatpages/views.py
index 518b157..aa1793d 100644
--- a/flatpages/views.py
+++ b/flatpages/views.py
@@ -1,5 +1,6 @@
import os
import re
+from pathlib import Path
from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect, Http404
@@ -52,15 +53,16 @@ def flatpage(request, path):
print(("flat path noinfo", path))
return HttpResponseRedirect(reverse("auth_login") + '?next=%s' % request.path)
+ expowebpath = Path(settings.EXPOWEB)
if path.endswith("/") or path == "":
#print(" - FLATPAGES the file: {} ENDSWITH ...".format(path))
try:
- o = open(os.path.normpath(settings.EXPOWEB + path + "index.html"), "rb")
+ o = open(os.path.normpath(expowebpath / path / "index.html"), "rb")
path = path + "index.html"
except IOError:
try:
- o = open(os.path.normpath(settings.EXPOWEB + path + "index.htm"), "rb")
+ o = open(os.path.normpath(expowebpath / path / "index.htm"), "rb")
path = path + "index.htm"
except IOError:
return render(request, 'pagenotfound.html', {'path': path})
@@ -77,8 +79,8 @@ def flatpage(request, path):
path = path.replace("static", settings.MEDIA_ROOT)
filetobeopened = os.path.normpath(path)
else:
- #print(" - NO _ROOT: {} ...".format(settings.EXPOWEB))
- filetobeopened = os.path.normpath(settings.EXPOWEB + path)
+ #print(" - NO _ROOT: {} ...".format(expowebpath))
+ filetobeopened = os.path.normpath(expowebpath / path)
#print(" - FLATPAGES full path : {} ...".format(filetobeopened))
o = open(filetobeopened, "rb")