aboutsummaryrefslogtreecommitdiffstats
path: root/famille.py
diff options
context:
space:
mode:
Diffstat (limited to 'famille.py')
-rw-r--r--famille.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/famille.py b/famille.py
index 6b128d6..87a1118 100644
--- a/famille.py
+++ b/famille.py
@@ -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: