diff options
author | Sam Wenham <sam@wenhams.co.uk> | 2020-02-21 14:26:14 +0000 |
---|---|---|
committer | Sam Wenham <sam@wenhams.co.uk> | 2020-02-21 14:26:14 +0000 |
commit | 92b273e45f96ac20fb182b9166b9f0a96f16eba3 (patch) | |
tree | a4b4b1ec972d5332ea590af6e84e8f83a592cae6 /flatpages/views.py | |
parent | 978270b152e803f0a8f1fac09363cc9703812567 (diff) | |
download | troggle-92b273e45f96ac20fb182b9166b9f0a96f16eba3.tar.gz troggle-92b273e45f96ac20fb182b9166b9f0a96f16eba3.tar.bz2 troggle-92b273e45f96ac20fb182b9166b9f0a96f16eba3.zip |
Whitespace cleanup
Diffstat (limited to 'flatpages/views.py')
-rw-r--r-- | flatpages/views.py | 11 |
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 = "" |