diff options
author | expo <expo@expobox.potato.hut> | 2012-08-06 12:56:20 +0200 |
---|---|---|
committer | expo <expo@expobox.potato.hut> | 2012-08-06 12:56:20 +0200 |
commit | 70a743f88bd1639bbf3b3fc38f8562f6f5b7133c (patch) | |
tree | c12c31c83c972880dd578fcc521f4e166d3e4b1a /flatpages | |
parent | 44eb3c0caffc1fbe52d647f1344487d9776b3455 (diff) | |
download | troggle-70a743f88bd1639bbf3b3fc38f8562f6f5b7133c.tar.gz troggle-70a743f88bd1639bbf3b3fc38f8562f6f5b7133c.tar.bz2 troggle-70a743f88bd1639bbf3b3fc38f8562f6f5b7133c.zip |
Prevent modification of auto generated files
Diffstat (limited to 'flatpages')
-rw-r--r-- | flatpages/views.py | 3 |
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 |