Whitespace cleanup

This commit is contained in:
Sam Wenham
2020-02-21 14:26:14 +00:00
parent 978270b152
commit 92b273e45f
5 changed files with 32 additions and 35 deletions

View File

@@ -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 = ""