summaryrefslogtreecommitdiff
path: root/devel/utils.py
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-12-12 20:18:51 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-12-12 20:18:51 -0500
commit6c5c3355a97d35afb7f1eee284966ad0bf8cee3b (patch)
tree8c68a1c118209a7d18c60d9c3c6960a6ae051bcf /devel/utils.py
parent03558d8b474d91be6cf21310916672ed62e920b7 (diff)
parent5d9f87c02bd8ad73fdb27600e0afe71284e3082f (diff)
Merge tag 'release_2012-04-07'
I hate writing tag messages. Conflicts: packages/templatetags/package_extras.py templates/packages/flag.html templates/packages/flaghelp.html templates/public/download.html templates/public/index.html templates/public/svn.html
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: