Fix issue with publisher
[cavote.git] / main.py
diff --git a/main.py b/main.py
index 3fcc5ae..4ccd46c 100755 (executable)
--- a/main.py
+++ b/main.py
@@ -135,7 +135,7 @@ def password_lost():
                 link,
                 "",
                 "If you think this mail is not for you, please ignore and delete it."
-                ), "\n")
+                ), "\r\n")
             server = smtplib.SMTP(SMTP_SERVER)
             server.sendmail(EMAIL, [user['email']], BODY)
             server.quit()
@@ -264,7 +264,7 @@ def admin_user_add():
                             "To log in for the first time and set your password, please follow this link :",
                             link,
                             ""
-                            ), "\n")
+                            ), "\r\n")
                             server = smtplib.SMTP(SMTP_SERVER)
                             server.sendmail(EMAIL, [user['email']], BODY)
                             server.quit()
@@ -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'))