2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 03:17:12 +00:00

static files redone

This commit is contained in:
Philip Sargent
2020-06-18 21:50:16 +01:00
parent bd6490631f
commit d9c6986a89
25 changed files with 122 additions and 151 deletions

View File

@@ -3,12 +3,10 @@ import re
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse
from django.urls import reverse, resolve
from django.template import Context, loader
import django.forms as forms
#from tinymce.widgets import TinyMCE
from troggle.helper import login_required_if_public
from troggle.flatpages.models import Redirect, EntranceRedirect
from troggle.core.models_caves import Cave
@@ -70,7 +68,7 @@ def flatpage(request, path):
if m:
preheader, headerattrs, head, postheader, bodyattrs, body, postbody = m.groups()
else:
return HttpResponse(html + "Page could not be split into header and body")
return HttpResponse(html + "Page could not be split into header and body: parsing failed in flatpages.views.py")
m = re.search(rb"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE)
if m:
title, = m.groups()
@@ -89,11 +87,12 @@ def flatpage(request, path):
menumatch = re.match(rb'(.*)<ul id="links">', body, re.DOTALL + re.IGNORECASE)
if menumatch:
has_menu = True
body, = menumatch.groups()
#body, = menumatch.groups()
# if re.search(rb"iso-8859-1", html):
# body = str(body, "iso-8859-1")
# body.strip
return render(request, 'flatpage.html', {'editable': editable, '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))