mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-03-31 13:46:03 +01:00
make people fill out git repo author field
This commit is contained in:
@@ -212,11 +212,7 @@ def get_cookie(request):
|
|||||||
# NO_COOKIE_DEFAULT = 'Unset Cookie <hohlenforscher@potatohut.expo>'
|
# NO_COOKIE_DEFAULT = 'Unset Cookie <hohlenforscher@potatohut.expo>'
|
||||||
print(f"-- Getting cookie...")
|
print(f"-- Getting cookie...")
|
||||||
editor_id = request.COOKIES.get('editor_id', "") # if no cookie, then default string ""
|
editor_id = request.COOKIES.get('editor_id', "") # if no cookie, then default string ""
|
||||||
if editor_id.startswith("Unset"):
|
editor = git_string(editor_id) # belt and braces, should have been validity checked on saving already
|
||||||
# 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
|
|
||||||
print(f"-- Cookie to be used: {editor=}")
|
print(f"-- Cookie to be used: {editor=}")
|
||||||
return 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,}>$')
|
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):
|
if author_regex.match(author_string):
|
||||||
print(f"++ Is valid git-compatible author string: '{author_string}'")
|
print(f"++ Is valid git-compatible author string: '{author_string}'")
|
||||||
return author_string
|
return author_string
|
||||||
|
|||||||
Reference in New Issue
Block a user