diff --git a/flatpages/views.py b/flatpages/views.py index 6279f4d..3357e64 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -47,12 +47,12 @@ def flatpage(request, path): o = open(os.path.normpath(settings.EXPOWEB + path + "index.htm"), "rb") path = path + "index.htm" except IOError: - raise Http404 + return render_with_context(request, 'pagenotfound.html', {'path': path}) else: try: o = open(os.path.normpath(settings.EXPOWEB + path), "rb") except IOError: - raise Http404 + return render_with_context(request, 'pagenotfound.html', {'path': path}) if path.endswith(".htm") or path.endswith(".html"): html = o.read() @@ -105,19 +105,22 @@ def editflatpage(request, path): try: filepath = os.path.normpath(settings.EXPOWEB + path) o = open(filepath, "r") + html = o.read() + m = re.search(r"(.*).*]*>(.*)", html, re.DOTALL) + if m: + filefound = True + head, body = m.groups() + if re.search(r"iso-8859-1", html): + linksmatch = re.match('(.*)