fedora_elections/elections.py | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
New commits:
commit 7fce149fbb8f2b324e3c779dd9cc97b1ba5acebd
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Aug 1 11:07:11 2014 +0200
Simplify checking if the user is allowed to view the result page when the election is
under embargo
diff --git a/fedora_elections/elections.py b/fedora_elections/elections.py
index 355eabb..70ea77f 100644
--- a/fedora_elections/elections.py
+++ b/fedora_elections/elections.py
@@ -309,26 +309,19 @@ def election_results(election_alias):
return election
elif election.embargoed:
- if not is_authenticated():
+ if is_authenticated() and (
+ is_admin(flask.g.fas_user)
+ or is_election_admin(flask.g.fas_user, election.id)):
+ flask.flash("You are only seeing this page because you are "
+ "an admin.", "warning")
+ flask.flash("The results for this election are currently "
+ "embargoed pending formal announcement.",
+ "warning")
+ else:
flask.flash("We are sorry. The results for this election "
"cannot be viewed because they are currently "
"embargoed pending formal announcement.")
return safe_redirect_back()
- else:
- if is_admin(flask.g.fas_user) \
- or is_election_admin(flask.g.fas_user, election.id):
- flask.flash("You are only seeing this page because you are "
- "an admin.", "warning")
- flask.flash("The results for this election are currently "
- "embargoed pending formal announcement.",
- "warning")
- pass
- else:
- flask.flash(
- "We are sorry. The results for this election "
- "cannot be viewed because they are currently "
- "embargoed pending formal announcement.")
- return safe_redirect_back()
if is_authenticated() and (is_admin(flask.g.fas_user) \
or is_election_admin(flask.g.fas_user, election.id)):
Show replies by date