diff --git a/flatpages/views.py b/flatpages/views.py index 3357e64..05405de 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -56,17 +56,17 @@ def flatpage(request, path): if path.endswith(".htm") or path.endswith(".html"): html = o.read() - m = re.search(r"<head>(.*)</head>.*<body[^>]*>(.*)</body>", html, re.DOTALL) + m = re.search(r"<head>(.*)</head>.*<body[^>]*>(.*)</body>", html, re.DOTALL + re.IGNORECASE) if m: head, body = m.groups() else: return HttpResponse(html + "Page could not be split into header and body") - m = re.search(r"<title>(.*)</title>", head, re.DOTALL) + m = re.search(r"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE) if m: title, = m.groups() else: title = "" - linksmatch = re.match('(.*)<ul id="links">', body, re.DOTALL) + linksmatch = re.match('(.*)<ul id="links">', body, re.DOTALL + re.IGNORECASE) if linksmatch: body, = linksmatch.groups() if re.search(r"iso-8859-1", html): @@ -106,12 +106,12 @@ def editflatpage(request, path): filepath = os.path.normpath(settings.EXPOWEB + path) o = open(filepath, "r") html = o.read() - m = re.search(r"<head>(.*)</head>.*<body[^>]*>(.*)</body>", html, re.DOTALL) + m = re.search(r"<head>(.*)</head>.*<body[^>]*>(.*)</body>", html, re.DOTALL + re.IGNORECASE) if m: filefound = True head, body = m.groups() if re.search(r"iso-8859-1", html): - linksmatch = re.match('(.*)<ul id="links">', body, re.DOTALL) + linksmatch = re.match('(.*)<ul id="links">', body, re.DOTALL + re.IGNORECASE) if linksmatch: body, = linksmatch.groups() body = unicode(body, "iso-8859-1") @@ -132,7 +132,7 @@ def editflatpage(request, path): return HttpResponseRedirect(reverse('flatpage', args=[path])) # Redirect after POST else: if filefound: - m = re.search(r"<title>(.*)</title>", head, re.DOTALL) + m = re.search(r"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE) if m: title, = m.groups() else: