summaryrefslogtreecommitdiffstats
path: root/flatpages
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
commita29fd964bdbae84c397af2f5e1211b12ebf01558 (patch)
tree99bb4baa1e73b79e4377db071da84a9c862c7896 /flatpages
parent1ef274ec1dca0c54ea3dbda6887960e8f665e2c9 (diff)
downloadtroggle-a29fd964bdbae84c397af2f5e1211b12ebf01558.tar.gz
troggle-a29fd964bdbae84c397af2f5e1211b12ebf01558.tar.bz2
troggle-a29fd964bdbae84c397af2f5e1211b12ebf01558.zip
Prevent modification of auto generated files
Diffstat (limited to 'flatpages')
-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