forked from expo/troggle
Prevent modification of auto generated files
This commit is contained in:
parent
44eb3c0caf
commit
70a743f88b
@ -107,6 +107,9 @@ def editflatpage(request, path):
|
|||||||
filepath = os.path.normpath(settings.EXPOWEB + path)
|
filepath = os.path.normpath(settings.EXPOWEB + path)
|
||||||
o = open(filepath, "r")
|
o = open(filepath, "r")
|
||||||
html = o.read()
|
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)
|
m = re.search(r"(.*)<head([^>]*)>(.*)</head>(.*)<body([^>]*)>(.*)</body>(.*)", html, re.DOTALL + re.IGNORECASE)
|
||||||
if m:
|
if m:
|
||||||
filefound = True
|
filefound = True
|
||||||
|
Loading…
Reference in New Issue
Block a user