summaryrefslogtreecommitdiffstats
path: root/core/utils.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2025-01-17 19:27:06 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2025-01-17 19:27:06 +0000
commitb94ea8eb22c85527132b0fdea61707a493404c01 (patch)
tree94dde67ed7107d30394935329226812197ee2622 /core/utils.py
parent54566ef09267ddbed8d86636b0855e561e368995 (diff)
downloadtroggle-b94ea8eb22c85527132b0fdea61707a493404c01.tar.gz
troggle-b94ea8eb22c85527132b0fdea61707a493404c01.tar.bz2
troggle-b94ea8eb22c85527132b0fdea61707a493404c01.zip
make people fill out git repo author field
Diffstat (limited to 'core/utils.py')
-rw-r--r--core/utils.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/utils.py b/core/utils.py
index 23d6a85..bfd6eee 100644
--- a/core/utils.py
+++ b/core/utils.py
@@ -212,11 +212,7 @@ def get_cookie(request):
# NO_COOKIE_DEFAULT = 'Unset Cookie <hohlenforscher@potatohut.expo>'
print(f"-- Getting cookie...")
editor_id = request.COOKIES.get('editor_id', "") # if no cookie, then default string ""
- if editor_id.startswith("Unset"):
- # clean out laziness in users' PCs
- editor_id = ""
- else:
- editor = git_string(editor_id) # belt and braces, should have been validity checked on saving already
+ editor = git_string(editor_id) # belt and braces, should have been validity checked on saving already
print(f"-- Cookie to be used: {editor=}")
return editor
@@ -227,6 +223,10 @@ def git_string(author_string):
"""
author_regex = re.compile(r'^[a-zA-Z][\w\s\_\.\-]* <[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-_]+\.[a-zA-Z]{2,}>$')
+ if author_string.startswith("Unset"):
+ # clean out laziness in users' PCs
+ return ""
+
if author_regex.match(author_string):
print(f"++ Is valid git-compatible author string: '{author_string}'")
return author_string