aboutsummaryrefslogtreecommitdiffstats
path: root/famille.py
diff options
context:
space:
mode:
Diffstat (limited to 'famille.py')
-rw-r--r--famille.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/famille.py b/famille.py
index d958bcb..0a4a3d6 100644
--- a/famille.py
+++ b/famille.py
@@ -193,13 +193,14 @@ def show_news(news_id):
elif request.method == 'POST':
user_id = session['user_id']
content = request.form['content']
- content_cache = rstify(content)
- db = get_db()
- db.execute("INSERT INTO comments "
- "('user_id', 'content', 'news_id', 'content_cache') "
- "VALUES (?, ?, ?, ?)",
- (user_id, content, news_id, content_cache))
- db.commit()
+ if content:
+ content_cache = rstify(content)
+ db = get_db()
+ db.execute("INSERT INTO comments "
+ "('user_id', 'content', 'news_id', 'content_cache') "
+ "VALUES (?, ?, ?, ?)",
+ (user_id, content, news_id, content_cache))
+ db.commit()
return redirect(url_for('show_news', news_id=news_id))