mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-16 22:57:14 +00:00
bugfix
This commit is contained in:
@@ -408,6 +408,9 @@ def getmimetype(path):
|
||||
def editexpopage(request, path):
|
||||
"""Manages the 'Edit this Page' capability for expo handbook and other html pages.
|
||||
Relies on HTML5 or javascript to provide the in-browser editing environment.
|
||||
|
||||
If the user is logged-on with a personal logon, then the Full Name and email
|
||||
address for the git commit are taken from their stored details, not from any stored cookie.
|
||||
"""
|
||||
try:
|
||||
# if a cave not a webpage at all.
|
||||
@@ -466,8 +469,9 @@ def editexpopage(request, path):
|
||||
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
|
||||
editor = pageform.cleaned_data["who_are_you"]
|
||||
editor = git_string(editor)
|
||||
if not identified_login:
|
||||
editor = pageform.cleaned_data["who_are_you"]
|
||||
editor = git_string(editor)
|
||||
if filefound:
|
||||
headmatch = re.match(r"(.*)<title>.*</title>(.*)", head, re.DOTALL + re.IGNORECASE)
|
||||
if headmatch:
|
||||
@@ -497,8 +501,9 @@ def editexpopage(request, path):
|
||||
print(f"Cookie set: {editor} for {COOKIE_MAX_AGE/(24*3600)} days")
|
||||
try:
|
||||
change_message = pageform.cleaned_data["change_message"]
|
||||
editor = pageform.cleaned_data["who_are_you"]
|
||||
editor = git_string(editor)
|
||||
if not identified_login:
|
||||
editor = pageform.cleaned_data["who_are_you"]
|
||||
editor = git_string(editor)
|
||||
write_and_commit([(filepath, result, "utf-8")], f"{change_message} - online edit of {path}", editor)
|
||||
except WriteAndCommitError as e:
|
||||
return render(request, "errors/generic.html", {"message": e.message})
|
||||
@@ -514,8 +519,10 @@ def editexpopage(request, path):
|
||||
pageform = ExpoPageForm(initial={"identified_login": identified_login, "who_are_you":editor, "html": body, "title": title})
|
||||
else:
|
||||
pageform = ExpoPageForm(initial={"identified_login": identified_login, "who_are_you":editor})
|
||||
|
||||
|
||||
if identified_login:
|
||||
# disable editing the git id string as we get it from the logged-on user data
|
||||
pageform.fields["who_are_you"].widget.attrs["readonly"]="readonly"
|
||||
return render(
|
||||
request,
|
||||
"editexpopage.html",
|
||||
|
||||
Reference in New Issue
Block a user