summaryrefslogtreecommitdiff
path: root/devel/utils.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-03-23 17:33:55 -0500
committerDan McGee <dan@archlinux.org>2012-04-07 14:53:08 -0500
commit1a2f117037fd8b01ec1e1e3cce5186d7bfac1a78 (patch)
treee47e83bc34af9ca22705f9d073f6cc36524edfa9 /devel/utils.py
parent84f98e3e0b9ef319f501795099cc32bce1bf6a81 (diff)
Add a mismatched signatures developer report
This finds odd signatures in our repositories, which includes signature times not matching with build dates, different signer and packager, etc. We enhance our user lookup helper class to look up users by PGP key. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'devel/utils.py')
-rw-r--r--devel/utils.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/devel/utils.py b/devel/utils.py
index ec035d13..85b4e42f 100644
--- a/devel/utils.py
+++ b/devel/utils.py
@@ -49,6 +49,7 @@ class UserFinder(object):
self.cache = {}
self.username_cache = {}
self.email_cache = {}
+ self.pgp_cache = {}
@staticmethod
def user_email(name, email):
@@ -146,9 +147,25 @@ class UserFinder(object):
self.email_cache[email] = user
return user
+ def find_by_pgp_key(self, pgp_key):
+ if not pgp_key:
+ return None
+ if pgp_key in self.pgp_cache:
+ return self.pgp_cache[pgp_key]
+
+ try:
+ user = User.objects.get(
+ userprofile__pgp_key__endswith=pgp_key)
+ except User.DoesNotExist:
+ user = None
+
+ self.pgp_cache[pgp_key] = user
+ return user
+
def clear_cache(self):
self.cache = {}
self.username_cache = {}
self.email_cache = {}
+ self.pgp_cache = {}
# vim: set ts=4 sw=4 et: