diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2020-04-10 13:13:23 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2020-04-10 13:13:23 +0100 |
commit | 6aae9083c3ec1782da18cae36ed688f24616a3ef (patch) | |
tree | 0039976f293df268e060a658bb676a41687650e5 | |
parent | d71e31417b1fce145dd75661d33f2c01f83cdf57 (diff) | |
download | troggle-6aae9083c3ec1782da18cae36ed688f24616a3ef.tar.gz troggle-6aae9083c3ec1782da18cae36ed688f24616a3ef.tar.bz2 troggle-6aae9083c3ec1782da18cae36ed688f24616a3ef.zip |
implemened NOEDIT as a meta tag and fixed double-menus problem
-rw-r--r-- | flatpages/views.py | 11 |
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)) |