elections/controllers.py | 12 ++++++++++--
elections/vote.py | 6 +++++-
2 files changed, 15 insertions(+), 3 deletions(-)
New commits:
commit 7537ef90d3e4e7252c8ddbcfced8227714ee0644
Author: Toshio Kuratomi <toshio(a)fedoraproject.org>
Date: Wed Apr 21 14:16:59 2010 -0400
Don't error out if human_name is unavailable
diff --git a/elections/controllers.py b/elections/controllers.py
index 7e32a3a..2c0fd0e 100644
--- a/elections/controllers.py
+++ b/elections/controllers.py
@@ -80,7 +80,11 @@ class Root(controllers.RootController):
if election.usefas:
for c in candidates:
- usernamemap[c.id] = self.fas.person_by_username(c.name)['human_name']
+ try:
+ usernamemap[c.id] = self.fas.person_by_username(c.name)['human_name']
+ except KeyError:
+ # User has their name set to private
+ usernamemap[c.id] = c.name
curtime = datetime.utcnow()
@@ -106,7 +110,11 @@ class Root(controllers.RootController):
if election.usefas:
for c in election.candidates:
- usernamemap[c.id] = self.fas.person_by_username(c.name)['human_name']
+ try:
+ usernamemap[c.id] = self.fas.person_by_username(c.name)['human_name']
+ except KeyError:
+ # User has their name set to private
+ usernamemap[c.id] = c.name
curtime = datetime.utcnow()
if election.end_date > curtime:
diff --git a/elections/vote.py b/elections/vote.py
index 81083bc..967e4f4 100644
--- a/elections/vote.py
+++ b/elections/vote.py
@@ -82,7 +82,11 @@ class Vote(controllers.Controller):
if election.usefas:
for c in candidates:
- usernamemap[c.id] = self.fas.person_by_username(c.name)['human_name']
+ try:
+ usernamemap[c.id] = self.fas.person_by_username(c.name)['human_name']
+ except KeyError:
+ # User has human_name set to private
+ usernamemap[c.id] = c.name
uvotes = {}
next_action = ""