summaryrefslogtreecommitdiffstats
path: root/flatpages/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'flatpages/views.py')
-rw-r--r--flatpages/views.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/flatpages/views.py b/flatpages/views.py
index 6ef2404..0ba4d4e 100644
--- a/flatpages/views.py
+++ b/flatpages/views.py
@@ -33,7 +33,6 @@ def flatpage(request, path):
except EntranceRedirect.DoesNotExist:
pass
-
if path.startswith("noinfo") and settings.PUBLIC_SITE and not request.user.is_authenticated():
print("flat path noinfo", path)
return HttpResponseRedirect(reverse("auth_login") + '?next=%s' % request.path)
@@ -48,7 +47,7 @@ def flatpage(request, path):
path = path + "index.htm"
except IOError:
return render(request, 'pagenotfound.html', {'path': path})
- else:
+ else:
try:
filetobeopened = os.path.normpath(settings.EXPOWEB + path)
o = open(filetobeopened, "rb")
@@ -56,7 +55,7 @@ def flatpage(request, path):
return render(request, 'pagenotfound.html', {'path': path})
if path.endswith(".htm") or path.endswith(".html"):
html = o.read()
-
+
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()
@@ -125,7 +124,7 @@ def editflatpage(request, path):
return HttpResponse("Page could not be split into header and body")
except IOError:
filefound = False
-
+
if request.method == 'POST': # If the form has been submitted...
flatpageForm = FlatPageForm(request.POST) # A form bound to the POST data
@@ -142,7 +141,7 @@ def editflatpage(request, path):
headerargs = ""
postheader = ""
bodyargs = ""
- postbody = "</html>"
+ postbody = "</html>"
body = flatpageForm.cleaned_data["html"]
body = body.replace("\r", "")
result = u"%s<head%s>%s</head>%s<body%s>\n%s</body>%s" % (preheader, headerargs, head, postheader, bodyargs, body, postbody)
@@ -153,7 +152,7 @@ def editflatpage(request, path):
else:
if filefound:
m = re.search(r"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE)
- if m:
+ if m:
title, = m.groups()
else:
title = ""