From b94ea8eb22c85527132b0fdea61707a493404c01 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Fri, 17 Jan 2025 19:27:06 +0000 Subject: make people fill out git repo author field --- core/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'core/utils.py') 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 ' 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 -- cgit v1.2.3