2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-17 06:47:27 +00:00

belt and braces prevent bad lbe ids

This commit is contained in:
2024-07-23 11:34:12 +02:00
parent feaf38aa39
commit 07fc372b41
3 changed files with 18 additions and 4 deletions

View File

@@ -306,7 +306,8 @@ def logbookedit(request, year=None, slug=None):
place = request.POST["place"].strip().replace(' - ',' = ') # no hyphens !
title = request.POST["title"].strip()
entry = request.POST["text"].strip()
slug = request.POST["slug"].strip()
if "slug" in request.POST:
slug = request.POST["slug"].strip() # if we are re-editing the same entry again
entry = entry.replace('\r','') # remove HTML-standard CR inserted from form.
entry = entry.replace('\n\n','\n<p>\n') # replace 2 \n with <br><br>
# entry = entry.replace('\n\n','\n<br />\n<br />\n') # replace 2 \n with <br><br>
@@ -334,7 +335,7 @@ def logbookedit(request, year=None, slug=None):
authorflag = True
print(f"! Unrecognised author: {author}")
# slug is set either because we already posted or because it was specified inthe url
if not slug:
# Creating a new logbook entry with all the gubbins
slug = create_new_lbe_slug(date)