diff options
author | Martin Green <martin.speleo@gmail.com> | 2011-08-08 12:58:02 +0100 |
---|---|---|
committer | Martin Green <martin.speleo@gmail.com> | 2011-08-08 12:58:02 +0100 |
commit | 9878cf890db44d693d8168dec167cde56006a8fb (patch) | |
tree | 36dec6a0e2bcd5b05eaeb0e298caa2d983640808 /flatpages/views.py | |
parent | fe1989001cca6c00f2b2fd75e47a57127d51926a (diff) | |
download | troggle-9878cf890db44d693d8168dec167cde56006a8fb.tar.gz troggle-9878cf890db44d693d8168dec167cde56006a8fb.tar.bz2 troggle-9878cf890db44d693d8168dec167cde56006a8fb.zip |
ignorecase when finding html tags
Diffstat (limited to 'flatpages/views.py')
-rw-r--r-- | flatpages/views.py | 12 |
1 files changed, 6 insertions, 6 deletions
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: |