2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-03-30 06:29:49 +01:00

make people fill out git repo author field

This commit is contained in:
2025-01-17 19:27:06 +00:00
parent 54566ef092
commit b94ea8eb22

View File

@@ -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