Mercurial > libervia-web
diff server_side/blog.py @ 306:52b1afd7ac3f
server_side: display rich text in blogs (addURLToText is now in sat_frontends/tools/strings)
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 18 Dec 2013 15:39:13 +0100 |
parents | 63e9b680d3e7 |
children | bbadd490e63c |
line wrap: on
line diff
--- a/server_side/blog.py Wed Dec 18 13:59:25 2013 +0100 +++ b/server_side/blog.py Wed Dec 18 15:39:13 2013 +0100 @@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. """ +from sat_frontends.tools.strings import addURLToText from server_side.html_tools import sanitizeHtml from twisted.internet import reactor, defer from twisted.web import server @@ -88,10 +89,11 @@ for entry in mblog_data: timestamp = float(entry.get('timestamp', 0)) _datetime = datetime.fromtimestamp(timestamp) + body = addURLToText(sanitizeHtml(entry['content'])).encode('utf-8') if 'xhtml' not in entry else entry['xhtml'].encode() request.write("""<div class='mblog_entry'><span class='mblog_timestamp'>%(date)s</span> <span class='mblog_content'>%(content)s</span></div>""" % { 'date': _datetime, - 'content': sanitizeHtml(entry['content']).encode('utf-8')}) + 'content': body}) request.write('</body></html>') request.finish()