From: Arnaud Delcasse Date: Thu, 30 Aug 2012 09:12:51 +0000 (+0200) Subject: Fix issue with publisher X-Git-Url: http://git.cyclocoop.org/data/%7B%24www_url%7Dadmin/config/%40%20%27icone_supprimer_signature%27%20=%3E%20%27Delete%20this%20signature%27%2C%20%27icone_valider_signature%27%20=%3E%20%27Validate%20this%20signature%27%2C%20%27image_administrer_rubrique%27%20=%3E%20%27You%20can%20manage%20this%20section%27%2C-%27impossible_modifier_login_auteur%27%20=%3E%20%27Login%20cannot%20be%20changed.%27%2C-%27impossible_modifier_pass_auteur%27%20=%3E%20%27Password%20cannot%20be%20changed.%27%2C%20%27info_1_article%27%20=%3E%20%271%20article%27%2C-%27info_1_article_syndique%27%20=%3E%20%271%20syndicated%20article%27%2C%20%27info_1_auteur%27%20=%3E%20%271%20author%27%2C%20%27info_1_message%27%20=%3E%20%271%20message%27%2C%20%27info_1_mot_cle%27%20=%3E%20%271%20keyword%27%2C%20%27info_1_rubrique%27%20=%3E%20%271%20section%27%2C-%27info_1_site%27%20=%3E%20%271%20site%27%2C%20%27info_1_visiteur%27%20=%3E%20%271%20visitor%27%2C%20%27info_activer_cookie%27%20=%3E%20%27You%20can%20activate%20an%20%3Cb%3Eadministration%20cookie%3C/b%3E%2C%20which%20allows%20you%20%20to%20switch%20easily%20between%20the%20public%20site%20and%20the%20private%20area.%27%2C%40%40%20-249%2C16%20%20213%2C13%20%40%40%20Do%20not%20submit%20this%20import%20request.%3Cp%3EFor%20more%20information%2C%20please%20see%20%3Ca%20href=?a=commitdiff_plain;h=3884468d1f06525285de49e5cee744d6ea482ae7;p=cavote.git Fix issue with publisher --- diff --git a/main.py b/main.py index da9316b..4ccd46c 100755 --- a/main.py +++ b/main.py @@ -432,7 +432,7 @@ def has_voted(idvote, iduser=-1): @app.route('/vote/', methods=['GET', 'POST']) def vote(idvote): - vote = query_db('select votes.*, groups.name as groupname, users.name as author from votes join groups on groups.id=votes.id_group join users on users.id = id_author where votes.id=?', [idvote], one=True) + vote = query_db('select votes.*, groups.name as groupname from votes join groups on groups.id=votes.id_group where votes.id=?', [idvote], one=True) if vote is None: abort(404) if can_see_vote(idvote, get_userid()): @@ -478,6 +478,11 @@ def vote(idvote): vote['percent'] = int((float(vote['nb_votes']) / float(vote['max_votes'])) * 100) if query_db('select * from user_group where id_group = ? and id_user = ?', [vote['id_group'], get_userid()], one=True) and not vote['is_terminated']: flash(u'Ce vote vous concerne !', 'info') + publisher = query_db("select name from users where id = ?", [vote['id_author']], one=True) + if publisher is None: + vote['author'] = "NDN" + else: + vote['author'] = publisher['name'] return render_template('vote.html', vote=vote, attachments=attachments, choices=choices, users=users.values(), can_vote=can_vote(idvote, get_userid())) flash(u'Vous n\'avez pas le droit de voir ce vote, désolé.') return redirect(url_for('home'))