From: Guillaume Subiron Date: Mon, 28 May 2012 13:23:30 +0000 (+0200) Subject: Debug archives/current X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/%40%20%27info_classement_2%27%20=%3E%20%27%C3%82%C2%A0out%20of%20%40liste%40%27%2C%20%27info_code_acces%27%20=%3E%20%27Do%20not%20forget%20your%20own%20access%20codes%21%27%2C%20%27info_compatibilite_html%27%20=%3E%20%27HTML%20norm%20to%20apply%27%2C-%27info_compresseur_gzip%27%20=%3E%20%27It%20is%20advisable%20to%20check%20first%20whether%20your%20hosting%20provider%20already%20systematically%20compresses%20PHP%20scripts.%20To%20do%20this%20you%20can%20use%20a%20service%20such%20as%20%40testgzip%40%27%2C-%27info_compresseur_texte%27%20=%3E%20%27If%20your%20server%20does%20not%20compress%20HTML%20pages%20before%20sending%20them%2C%20you%20can%20attempt%20to%20force%20compression%20in%20order%20to%20reduce%20the%20size%20of%20the%20pages%20transmitted.%3Cb%3EWarning%3C/%40%20%27entree_url%27%20=%3E%20%27URL%20of%20your%20site%27%2C%20%27entree_url_2%27%20=%3E%20%27Site%20URL%27%2C%20%27erreur_connect_deja_existant%27%20=%3E%20%27There%20is%20already%20a%20server%20with%20that%20name%20%27%2C%20%27erreur_email_deja_existant%27%20=%3E%20%27This%20email%20address%20is%20already%20registered.%27%2C%20%27erreur_nom_connect_incorrect%27%20=%3E%20%27Server%20name%20not%20allowed%27%2C%20%27erreur_plugin_desinstalation_echouee%27%20=%3E%20%27Uninstallation%20of%20the%20plugin%20failed.%20However%2C%20you%20may%20deactivate%20it.%27%2C%20%27erreur_plugin_fichier_absent%27%20=%3E%20%27File%20missing%27%2C%40%40%20-175%2C7%20%20147%2C7%20%40%40%20Do%20not%20submit%20this%20import%20request.%3Cp%3EFor%20more%20information%2C%20please%20see%20%3Ca%20href=?a=commitdiff_plain;h=10e7bb1b361c544099c610103f115d11b5a61889;p=cavote.git Debug archives/current --- diff --git a/main.py b/main.py index ea1179e..d6f01db 100755 --- a/main.py +++ b/main.py @@ -71,13 +71,13 @@ def logout(): @app.route('/votes/') def show_votes(votes): - today = date.today().strftime('%d %B %Y') + today = date.today() if votes == 'all': cur = g.db.execute('select title, description, date_begin, date_end from votes order by id desc') elif votes == 'archives': - cur = g.db.execute('select title, description, date_begin, date_end from votes where date_end < :today order by id desc', {"today" : today}) + cur = g.db.execute('select title, description, date_begin, date_end from votes where date_end < (?) order by id desc', [today]) elif votes == 'currently': - cur = g.db.execute('select title, description, date_begin, date_end from votes where date_end > :today order by id desc', {"today" : today}) + cur = g.db.execute('select title, description, date_begin, date_end from votes where date_end >= (?) order by id desc', [today]) else: abort(404) votes = [dict(title=row[0], description=row[1], date_begin=row[2], date_end=row[3], @@ -97,8 +97,8 @@ def new_vote(): def add_vote(): if not session.get('logged_in'): abort(401) - daten = date.today() + timedelta(days=int(request.form['days'])) - ndate = daten.strftime('%d %B %Y') + date_begin = date.today() + date_end = date.today() + timedelta(days=int(request.form['days'])) transparent = 0 public = 0 multiplechoice = 0 @@ -108,8 +108,8 @@ def add_vote(): public = 1 if 'multiplechoice' in request.form.keys(): multiplechoice = 1 - g.db.execute('insert into votes (title, description, date_end, is_transparent, is_public, is_multiplechoice) values (?, ?, ?, ?, ?, ?)', - [request.form['title'], request.form['description'], ndate, transparent, public, multiplechoice]) + g.db.execute('insert into votes (title, description, date_begin, date_end, is_transparent, is_public, is_multiplechoice) values (?, ?, ?, ?, ?, ?, ?)', + [request.form['title'], request.form['description'], date_begin, date_end, transparent, public, multiplechoice]) g.db.commit() flash('New entry was successfully posted') return redirect(url_for('home'))