mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-18 07:07:10 +00:00
oops
This commit is contained in:
@@ -451,11 +451,14 @@ def editexpopage(request, path):
|
||||
print("### File not found ### ", filepath)
|
||||
filefound = False
|
||||
|
||||
editor_name = request.COOKIES.get('editor_id', '') # if no cookie, then get empty string
|
||||
|
||||
if request.method == "POST": # If the form has been submitted...
|
||||
pageform = ExpoPageForm(request.POST) # A form bound to the POST data
|
||||
if pageform.is_valid(): # Form valid therefore write file
|
||||
# print("### \n", str(pageform)[0:300])
|
||||
# print("### \n csrfmiddlewaretoken: ",request.POST['csrfmiddlewaretoken'])
|
||||
if not editor_name:
|
||||
if filefound:
|
||||
headmatch = re.match(r"(.*)<title>.*</title>(.*)", head, re.DOTALL + re.IGNORECASE)
|
||||
if headmatch:
|
||||
@@ -476,7 +479,7 @@ def editexpopage(request, path):
|
||||
bodyargs = ""
|
||||
postbody = "</html>\n"
|
||||
body = pageform.cleaned_data["html"]
|
||||
body = body.replace("\r", "\n")
|
||||
body = body.replace("\r", "")
|
||||
result = f"{preheader}<head{headerargs}>{head}</head>{postheader}<body{bodyargs}>\n{body}</body>{postbody}"
|
||||
|
||||
if not filefound or result != html: # Check if content changed at all
|
||||
@@ -495,9 +498,11 @@ def editexpopage(request, path):
|
||||
(title,) = m.groups()
|
||||
else:
|
||||
title = ""
|
||||
pageform = ExpoPageForm(initial={"html": body, "title": title})
|
||||
pageform = ExpoPageForm(initial={"who_are_you":editor_name, "html": body, "title": title})
|
||||
else:
|
||||
pageform = ExpoPageForm()
|
||||
pageform = ExpoPageForm(initial={"who_are_you":editor_name})
|
||||
|
||||
|
||||
return render(
|
||||
request,
|
||||
"editexpopage.html",
|
||||
@@ -528,7 +533,7 @@ class ExpoPageForm(forms.Form):
|
||||
)
|
||||
who_are_you = forms.CharField(
|
||||
widget=forms.Textarea(
|
||||
attrs={"cols": 90, "rows": 1, "placeholder": "You have edited this page, who are you ? e.g. 'Animal <mta@loveshack.expo>'",
|
||||
attrs={"cols": 90, "rows": 1, "placeholder": "You have edited this page, who are you ? e.g. 'Animal <mta@gasthof.expo>'",
|
||||
"style": "vertical-align: text-top;"}
|
||||
),
|
||||
label = "Editor"
|
||||
|
||||
Reference in New Issue
Block a user