summaryrefslogtreecommitdiffstats
path: root/core/views/expo.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2025-01-26 19:23:07 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2025-01-26 19:23:07 +0000
commitaef0de715d8c9768924fd3dfada037f48ac01a15 (patch)
tree8fb1f514631e9db910ff21bd192339d1c25f1b86 /core/views/expo.py
parentce508b0eb28551efbb9d7aaf18f1e76994e7c38b (diff)
downloadtroggle-aef0de715d8c9768924fd3dfada037f48ac01a15.tar.gz
troggle-aef0de715d8c9768924fd3dfada037f48ac01a15.tar.bz2
troggle-aef0de715d8c9768924fd3dfada037f48ac01a15.zip
bugfix
Diffstat (limited to 'core/views/expo.py')
-rw-r--r--core/views/expo.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/core/views/expo.py b/core/views/expo.py
index 63f1d33..821decc 100644
--- a/core/views/expo.py
+++ b/core/views/expo.py
@@ -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",