mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-05-04 06:33:15 +08:00
Hotfixes for nuancier
This commit is contained in:
@@ -74,7 +74,7 @@
|
||||
dest={{ item.location }}/{{ item.file }}
|
||||
owner=root group=root mode=0644
|
||||
with_items:
|
||||
- { file: __init__.py, location: /usr/lib/python2.6/site-packages/nuancier/__init__.py }
|
||||
- { file: __init__.py, location: /usr/lib/python2.6/site-packages/nuancier }
|
||||
tags:
|
||||
- config
|
||||
- hotfix
|
||||
@@ -86,7 +86,7 @@
|
||||
dest={{ item.location }}/{{ item.file }}
|
||||
owner=root group=root mode=0644
|
||||
with_items:
|
||||
- { file: model.py, location: /usr/lib/python2.6/site-packages/nuancier/model.py }
|
||||
- { file: model.py, location: /usr/lib/python2.6/site-packages/nuancier/lib }
|
||||
tags:
|
||||
- config
|
||||
- hotfix
|
||||
|
||||
@@ -88,11 +88,14 @@ def fas_login_required(function):
|
||||
"""
|
||||
@wraps(function)
|
||||
def decorated_function(*args, **kwargs):
|
||||
if flask.g.fas_user is None \
|
||||
or not flask.g.fas_user.cla_done \
|
||||
or len(flask.g.fas_user.groups) < 1:
|
||||
if flask.g.fas_user is None:
|
||||
return flask.redirect(flask.url_for(
|
||||
'.login', next=flask.request.url))
|
||||
if not flask.g.fas_user.cla_done \
|
||||
or len(flask.g.fas_user.groups) < 1:
|
||||
flask.flash('You need to have signed the FPCA and be in one non-CLA'
|
||||
' group to vote in this election', 'errors')
|
||||
return flask.redirect(flask.url_for('index'))
|
||||
return function(*args, **kwargs)
|
||||
return decorated_function
|
||||
|
||||
@@ -103,15 +106,13 @@ def nuancier_admin_required(function):
|
||||
"""
|
||||
@wraps(function)
|
||||
def decorated_function(*args, **kwargs):
|
||||
if flask.g.fas_user is None or \
|
||||
not flask.g.fas_user.cla_done or \
|
||||
len(flask.g.fas_user.groups) < 1:
|
||||
if flask.g.fas_user is None:
|
||||
return flask.redirect(flask.url_for('.login',
|
||||
next=flask.request.url))
|
||||
elif not is_nuancier_admin():
|
||||
flask.flash('You are not an administrator of nuancier-lite',
|
||||
'errors')
|
||||
return flask.redirect(flask.url_for('msg'))
|
||||
return flask.redirect(flask.url_for('index'))
|
||||
else:
|
||||
return function(*args, **kwargs)
|
||||
return decorated_function
|
||||
|
||||
@@ -268,7 +268,7 @@ class Candidates(BASE):
|
||||
).filter(
|
||||
Candidates.id == Votes.candidate_id
|
||||
).group_by(
|
||||
Candidates.id
|
||||
Candidates.id, Candidates.candidate_file, Candidates.candidate_name, Candidates.candidate_author, Candidates.election_id, Candidates.date_created, Candidates.date_updated
|
||||
).order_by(
|
||||
'votes DESC'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user