Mercurial > libervia-web
comparison src/server/blog.py @ 588:c8cca1a373dd
server_side: static blog: convert \n in raw text message to <br/>
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 15 Dec 2014 16:03:01 +0100 |
parents | 3eb3a2c0c011 |
children | a90cc8fc9605 |
comparison
equal
deleted
inserted
replaced
587:6a1fea10ae8c | 588:c8cca1a373dd |
---|---|
29 from datetime import datetime | 29 from datetime import datetime |
30 import uuid | 30 import uuid |
31 import re | 31 import re |
32 import os | 32 import os |
33 | 33 |
34 from libervia.server.html_tools import sanitizeHtml | 34 from libervia.server.html_tools import sanitizeHtml, convertNewLinesToXHTML |
35 from libervia.server.constants import Const as C | 35 from libervia.server.constants import Const as C |
36 | 36 |
37 | 37 |
38 class MicroBlog(Resource): | 38 class MicroBlog(Resource): |
39 isLeaf = True | 39 isLeaf = True |
346 def getText(key): | 346 def getText(key): |
347 if ('%s_xhtml' % key) in entry: | 347 if ('%s_xhtml' % key) in entry: |
348 return entry['%s_xhtml' % key].encode('utf-8') | 348 return entry['%s_xhtml' % key].encode('utf-8') |
349 elif key in entry: | 349 elif key in entry: |
350 processor = addURLToText if key.startswith('content') else sanitizeHtml | 350 processor = addURLToText if key.startswith('content') else sanitizeHtml |
351 return processor(entry[key]).encode('utf-8') | 351 return convertNewLinesToXHTML(processor(entry[key])).encode('utf-8') |
352 return '' | 352 return '' |
353 | 353 |
354 def addMainItemLink(elem): | 354 def addMainItemLink(elem): |
355 if not item_link or not elem: | 355 if not item_link or not elem: |
356 return elem | 356 return elem |