Cleanup
authorGuillaume Subiron <maethor@subiron.org>
Wed, 30 May 2012 19:59:10 +0000 (21:59 +0200)
committerJulien Rabier <taziden@flexiden.org>
Thu, 31 May 2012 12:10:25 +0000 (14:10 +0200)
main.py
schema.sql
templates/admin_users.html

diff --git a/main.py b/main.py
index 735fa6d..a8f91a6 100755 (executable)
--- a/main.py
+++ b/main.py
@@ -171,7 +171,7 @@ def admin_users():
             users[t['userid']]['is_admin'] = t['is_admin']
             users[t['userid']]['roles'] = [t['rolename']]
 
-    return render_template('admin_users.html', users=users)
+    return render_template('admin_users.html', users=users.values())
 
 @app.route('/admin/users/add', methods=['GET', 'POST'])
 def admin_user_add():
@@ -266,12 +266,12 @@ def can_see_vote(idvote, iduser=-1):
     vote = query_db('select * from votes where id=?', [idvote], one=True)
     if user is None and not vote.is_public:
         return False
-    return True # :TODO:maethor:20120529: Check others things
+    return True # :TODO:maethor:120529: Check others things
 
 def can_vote(idvote, iduser=-1):
     if not can_see_vote(idvote, iduser):
         return False
-    return True # :TODO:maethor:20120529: Check others things
+    return True # :TODO:maethor:120529: Check others things
 
 @app.route('/vote/<idvote>')
 def vote(idvote):
@@ -319,7 +319,7 @@ def admin_vote_add():
                     [request.form['title'], request.form['description'], request.form['category'], date_begin, date_end, transparent, public, multiplechoice, role['id'], session['user']['id']])
             g.db.commit()
             vote = query_db('select * from votes where title = ? and date_begin = ? order by id desc', 
-                    [request.form['title'], date_begin], one=True) # :DEBUG:maethor:20120528: Bug possible car le titre n'est pas unique
+                    [request.form['title'], date_begin], one=True) # :DEBUG:maethor:120528: Bug possible car le titre n'est pas unique
             if vote is None:
                 flash(u'Une erreur est survenue !', 'error')
                 return redirect(url_for('home'))
@@ -348,7 +348,7 @@ def admin_vote_edit(voteid):
             if 'public' in request.form.keys():
                 public = 1
             isopen = 0
-            if request.form['status'] == 'Ouvert': # :TODO:maethor:20120529: Check if there is at least 2 choices before
+            if request.form['status'] == 'Ouvert': # :TODO:maethor:120529: Check if there is at least 2 choices before
                 isopen = 1
             g.db.execute('update votes set title = ?, description = ?, category = ?, is_transparent = ?, is_public = ?, is_open = ? where id = ?',
                     [request.form['title'], request.form['description'], request.form['category'], transparent, public, isopen, voteid])
@@ -358,7 +358,7 @@ def admin_vote_edit(voteid):
         else:
             flash(u'Vous devez spécifier un titre.', 'error')
 
-    # :TODO:maethor:20120529: Calculer la durée du vote (différence date_end - date_begin) 
+    # :TODO:maethor:120529: Calculer la durée du vote (différence date_end - date_begin) 
     vote['duration'] = 15
     group = query_db('select name from roles where id = ?', [vote['id_role']], one=True) 
     choices = query_db('select * from choices where id_vote = ?', [voteid])
@@ -385,7 +385,7 @@ def admin_vote_editchoice(voteid, choiceid):
     if request.method == 'POST':
         g.db.execute('update choices set name=? where id = ? and id_vote = ?', [request.form['title'], choiceid, voteid])
         g.db.commit()
-    elif request.method == 'DELETE': # :COMMENT:maethor:20120528: I can't find how to use it from template
+    elif request.method == 'DELETE': # :COMMENT:maethor:120528: I can't find how to use it from template
         g.db.execute('delete from choices where id = ? and id_vote = ?', [choiceid, voteid])
         g.db.commt()
     return redirect(url_for('admin_vote_edit', voteid=voteid))
index 11001d6..f03e176 100644 (file)
@@ -1,9 +1,9 @@
 drop table if exists choices;
 drop table if exists attachments;
 drop table if exists votes;
+drop table if exists user_role;
 drop table if exists roles;
 drop table if exists users;
-drop table if exists user_role;
 
 create table users (
     id INTEGER primary key autoincrement,
index c1934a7..d45f800 100644 (file)
@@ -17,7 +17,7 @@
     </tr>
     </thead>
     <tbody>
-    {% for user in users.values() %}
+    {% for user in users %}
     <tr>
       <td>{{ user.email }}</td>
       <td>{{ user.username }}</td>