From f527bd616abcfe3ccbcc08fbdfacdb4c4a22e5f0 Mon Sep 17 00:00:00 2001 From: Martin Green Date: Sun, 7 Aug 2011 17:30:18 +0100 Subject: bug fix for edit link for index files --- flatpages/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'flatpages/views.py') diff --git a/flatpages/views.py b/flatpages/views.py index e9db223..eed5f38 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -45,7 +45,7 @@ def flatpage(request, path): except IOError: try: o = open(os.path.normpath(settings.EXPOWEB + path + "index.htm"), "rb") - path = path + "index.html" + path = path + "index.htm" except IOError: raise Http404 else: -- cgit v1.2.3 From da3efb97ceeb73efd59a3345532e65336cf3ba49 Mon Sep 17 00:00:00 2001 From: Martin Green Date: Sun, 7 Aug 2011 19:17:27 +0100 Subject: Changed regex for finding head and body of flat pages. --- flatpages/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'flatpages/views.py') diff --git a/flatpages/views.py b/flatpages/views.py index eed5f38..f411bfa 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -15,7 +15,6 @@ import os import re def flatpage(request, path): - print "gggggg", path try: r = Redirect.objects.get(originalURL = path) return HttpResponseRedirect(r.newURL) # Redirect after POST @@ -103,7 +102,7 @@ def editflatpage(request, path): except IOError: raise Http404 html = o.read() - m = re.search(r"(.*).*(.*)", html, re.DOTALL) + m = re.search(r"(.*).*]*>(.*)", html, re.DOTALL) if m: head, body = m.groups() if re.search(r"iso-8859-1", html): -- cgit v1.2.3 From d75bad22de7e41a7049f6873762f0c38a62cff30 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 ++++++++++++++++++++++++-------- 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 (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('(.*)