summaryrefslogtreecommitdiffstats
path: root/flatpages/views.py
diff options
context:
space:
mode:
authorexpo <expo@expobox.potato.hut>2012-08-06 12:56:20 +0200
committerexpo <expo@expobox.potato.hut>2012-08-06 12:56:20 +0200
commit70a743f88bd1639bbf3b3fc38f8562f6f5b7133c (patch)
treec12c31c83c972880dd578fcc521f4e166d3e4b1a /flatpages/views.py
parent44eb3c0caffc1fbe52d647f1344487d9776b3455 (diff)
downloadtroggle-70a743f88bd1639bbf3b3fc38f8562f6f5b7133c.tar.gz
troggle-70a743f88bd1639bbf3b3fc38f8562f6f5b7133c.tar.bz2
troggle-70a743f88bd1639bbf3b3fc38f8562f6f5b7133c.zip
Prevent modification of auto generated files
Diffstat (limited to 'flatpages/views.py')
-rw-r--r--flatpages/views.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/flatpages/views.py b/flatpages/views.py
index 6fb68bb..3a1bc40 100644
--- a/flatpages/views.py
+++ b/flatpages/views.py
@@ -107,6 +107,9 @@ def editflatpage(request, path):
filepath = os.path.normpath(settings.EXPOWEB + path)
o = open(filepath, "r")
html = o.read()
+ autogeneratedmatch = re.search(r"\<\!--\s*(.*?(Do not edit|auto-generated).*?)\s*--\>", html, re.DOTALL + re.IGNORECASE)
+ if autogeneratedmatch:
+ return HttpResponse(autogeneratedmatch.group(1))
m = re.search(r"(.*)<head([^>]*)>(.*)</head>(.*)<body([^>]*)>(.*)</body>(.*)", html, re.DOTALL + re.IGNORECASE)
if m:
filefound = True