diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2012-11-08 00:15:24 +0100 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2012-11-08 00:15:24 +0100 |
| commit | 1ab9d17135c87253d9e1531cc31cf1b4ac94eceb (patch) | |
| tree | af0b9ce70643fad3f0a1f7adac6df08179af9984 /famille.py | |
| parent | 610003b80cb42c82493517c16b04f5d223c4a21c (diff) | |
| download | famille-flask-1ab9d17135c87253d9e1531cc31cf1b4ac94eceb.tar.gz | |
Also use rst for news content
Diffstat (limited to 'famille.py')
| -rw-r--r-- | famille.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -8,7 +8,7 @@ import hashlib from docutils import core from docutils.writers.html4css1 import Writer -def rstify_comment(string): +def rstify(string): w = Writer() result = core.publish_parts(string, writer=w)['fragment'] return result @@ -53,9 +53,10 @@ def list_news(): @login_required def add_news(): if request.method == 'POST': + content = rstify(request.form['content']) cur = g.db.execute("INSERT INTO news ('title', 'content', 'user_id') " "VALUES (?, ?, ?)", - (request.form['title'], request.form['content'], + (request.form['title'], content, session['user_id'])) news_id = cur.lastrowid g.db.commit() @@ -80,7 +81,7 @@ def show_news(news_id): "VALUES (?, ?, ?)", (user_id, content, news_id)) g.db.commit() return redirect(url_for('show_news', news_id=news_id)) - + @app.route('/login/', methods=['GET', 'POST']) def login(): if 'user_name' in session: |
