From 13fe89af9fe03382b25079f159c2bff27df32c0d Mon Sep 17 00:00:00 2001 From: Martin Green Date: Mon, 8 Aug 2011 09:51:47 +0100 Subject: [PATCH] Allow for editing flatpage titles, and made a common uneditable list of links. --- flatpages/views.py | 32 ++++++++++++++++++++++-------- templates/cavebase.html | 7 +------ templates/dataformat/flatfile.html | 4 +++- templates/editflatpage.html | 2 +- templates/flatpage.html | 6 +++--- templates/menu.html | 12 +++++++++++ 6 files changed, 44 insertions(+), 19 deletions(-) create mode 100644 templates/menu.html 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('(.*)