forked from expo/troggle
implemened NOEDIT as a meta tag and fixed double-menus problem
This commit is contained in:
parent
d71e31417b
commit
6aae9083c3
@ -67,15 +67,24 @@ def flatpage(request, path):
|
|||||||
title, = m.groups()
|
title, = m.groups()
|
||||||
else:
|
else:
|
||||||
title = ""
|
title = ""
|
||||||
|
m = re.search(r"<meta([^>]*)noedit", head, re.DOTALL + re.IGNORECASE)
|
||||||
|
if m:
|
||||||
|
editable = False
|
||||||
|
else:
|
||||||
|
editable = True
|
||||||
|
|
||||||
has_menu = False
|
has_menu = False
|
||||||
menumatch = re.match('(.*)<div id="menu">', body, re.DOTALL + re.IGNORECASE)
|
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:
|
if menumatch:
|
||||||
has_menu = True
|
has_menu = True
|
||||||
#body, = menumatch.groups()
|
#body, = menumatch.groups()
|
||||||
if re.search(r"iso-8859-1", html):
|
if re.search(r"iso-8859-1", html):
|
||||||
body = unicode(body, "iso-8859-1")
|
body = unicode(body, "iso-8859-1")
|
||||||
body.strip
|
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:
|
else:
|
||||||
return HttpResponse(o.read(), content_type=getmimetype(path))
|
return HttpResponse(o.read(), content_type=getmimetype(path))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user