diff options
Diffstat (limited to 'famille.py')
| -rw-r--r-- | famille.py | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -5,6 +5,13 @@ from flask import Flask, request, session, g, redirect, url_for, \ abort, render_template, flash, _app_ctx_stack from functools import wraps import hashlib +from docutils import core +from docutils.writers.html4css1 import Writer + +def rstify_comment(string): + w = Writer() + result = core.publish_parts(string, writer=w)['fragment'] + return result # configuration app = Flask(__name__) @@ -68,7 +75,7 @@ def show_news(news_id): return render_template("news/show.html", news=news, comments=comments) elif request.method == 'POST': user_id = session['user_id'] - content = request.form['content'] + content = rstify(request.form['content']) g.db.execute("INSERT INTO comments ('user_id', 'content', 'news_id') " "VALUES (?, ?, ?)", (user_id, content, news_id)) g.db.commit() |
