summaryrefslogtreecommitdiffstats
path: root/flatpages/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'flatpages/views.py')
-rw-r--r--flatpages/views.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/flatpages/views.py b/flatpages/views.py
index 6ef2404..d265c75 100644
--- a/flatpages/views.py
+++ b/flatpages/views.py
@@ -67,15 +67,24 @@ def flatpage(request, path):
title, = m.groups()
else:
title = ""
+ m = re.search(r"<meta([^>]*)noedit", head, re.DOTALL + re.IGNORECASE)
+ if m:
+ editable = False
+ else:
+ editable = True
+
has_menu = False
menumatch = re.match('(.*)<div id="menu">', body, re.DOTALL + re.IGNORECASE)
if menumatch:
has_menu = True
+ menumatch = re.match('(.*)<ul id="links">', body, re.DOTALL + re.IGNORECASE)
+ if menumatch:
+ has_menu = True
#body, = menumatch.groups()
if re.search(r"iso-8859-1", html):
body = unicode(body, "iso-8859-1")
body.strip
- return render(request, 'flatpage.html', {'editable': True, 'path': path, 'title': title, 'body': body, 'homepage': (path == "index.htm"), 'has_menu': has_menu})
+ return render(request, 'flatpage.html', {'editable': editable, 'path': path, 'title': title, 'body': body, 'homepage': (path == "index.htm"), 'has_menu': has_menu})
else:
return HttpResponse(o.read(), content_type=getmimetype(path))