summaryrefslogtreecommitdiffstats
path: root/core/utils.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2025-01-26 19:04:56 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2025-01-26 19:04:56 +0000
commitce508b0eb28551efbb9d7aaf18f1e76994e7c38b (patch)
tree7d9086dcc8b4d73959018d6f7ccd5e13b858c37a /core/utils.py
parent7fab42fa9e4067fdd99eca81d736d37c50f27291 (diff)
downloadtroggle-ce508b0eb28551efbb9d7aaf18f1e76994e7c38b.tar.gz
troggle-ce508b0eb28551efbb9d7aaf18f1e76994e7c38b.tar.bz2
troggle-ce508b0eb28551efbb9d7aaf18f1e76994e7c38b.zip
Use logon not cookie when editing pages
Diffstat (limited to 'core/utils.py')
-rw-r--r--core/utils.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/utils.py b/core/utils.py
index 33872b3..d88f39f 100644
--- a/core/utils.py
+++ b/core/utils.py
@@ -157,6 +157,25 @@ def current_expo():
else:
return settings.EPOCH.year # this is 1970
+def is_identified_user(user):
+ if user.is_anonymous:
+ return False
+ if user.username in ["expo", "expoadmin"]:
+ return False
+ return True
+
+def get_git_string(user):
+ if not is_identified_user(user):
+ return None
+ else:
+ people = Person.objects.filter(user=user)
+ if len(people) != 1:
+ # someone like "fluffy-bunny" not associated with a Person
+ return None
+ person = people[0]
+ return f"{person.fullname} <{user.email}>"
+
+
def parse_aliases(aliasfile):
"""Reads a long text string containing pairs of strings:
(alias, target)