diff options
Diffstat (limited to 'flatpages')
-rw-r--r-- | flatpages/views.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/flatpages/views.py b/flatpages/views.py index 6503d40..672ec0c 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -35,7 +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 + print("flat path noinfo", path) return HttpResponseRedirect(reverse("auth_login") + '?next=%s' % request.path) if path.endswith("/") or path == "": @@ -67,13 +67,15 @@ def flatpage(request, path): title, = m.groups() else: title = "" - linksmatch = re.match('(.*)<ul id="links">', body, re.DOTALL + re.IGNORECASE) - if linksmatch: - body, = linksmatch.groups() + has_menu = False + menumatch = re.match('(.*)<div id="menu">', 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_with_context(request, 'flatpage.html', {'editable': True, 'path': path, 'title': title, 'body': body, 'homepage': (path == "index.htm")}) + return render_with_context(request, 'flatpage.html', {'editable': True, 'path': path, 'title': title, 'body': body, 'homepage': (path == "index.htm"), 'has_menu': has_menu}) else: return HttpResponse(o.read(), content_type=getmimetype(path)) |