From 13fe89af9fe03382b25079f159c2bff27df32c0d Mon Sep 17 00:00:00 2001 From: Martin Green Date: Mon, 8 Aug 2011 09:51:47 +0100 Subject: Allow for editing flatpage titles, and made a common uneditable list of links. --- flatpages/views.py | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'flatpages/views.py') diff --git a/flatpages/views.py b/flatpages/views.py index f411bfa..1a445ea 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -35,6 +35,7 @@ def flatpage(request, path): 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) if path.endswith("/") or path == "": @@ -56,17 +57,22 @@ def flatpage(request, path): html = o.read() m = re.search(r"(.*).*(.*)", html, re.DOTALL) - mwithid = re.search(r'(.*).*(.*)', html, re.DOTALL) if m: head, body = m.groups() - bodyid = None - elif mwithid: - head, bodyid, body = mwithid.groups() else: return HttpResponse(html + "Page could not be split into header and body") + m = re.search(r"(.*)", head, re.DOTALL) + if m: + title, = m.groups() + else: + title = "" + linksmatch = re.match('(.*)