Mercurial > libervia-web
comparison src/server/blog.py @ 847:330db23d4a44
server (blog): call fixXHTMLLinks on XHTML content
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 15 Jan 2016 12:30:21 +0100 |
parents | 25931797db20 |
children | 0dfb76b13115 |
comparison
equal
deleted
inserted
replaced
846:c1907a460f6a | 847:330db23d4a44 |
---|---|
17 | 17 |
18 # You should have received a copy of the GNU Affero General Public License | 18 # You should have received a copy of the GNU Affero General Public License |
19 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | 20 |
21 from sat.core.i18n import _, D_ | 21 from sat.core.i18n import _, D_ |
22 from sat_frontends.tools.strings import addURLToText | 22 from sat_frontends.tools.strings import addURLToText, fixXHTMLLinks |
23 from sat.core.log import getLogger | 23 from sat.core.log import getLogger |
24 log = getLogger(__name__) | 24 log = getLogger(__name__) |
25 from sat.tools import common | 25 from sat.tools import common |
26 from dbus.exceptions import DBusException | 26 from dbus.exceptions import DBusException |
27 from twisted.internet import defer | 27 from twisted.internet import defer |
607 if comments: | 607 if comments: |
608 self.comments = [BlogMessage(request, base_url, comment) for comment in comments] | 608 self.comments = [BlogMessage(request, base_url, comment) for comment in comments] |
609 | 609 |
610 def getText(self, entry, key): | 610 def getText(self, entry, key): |
611 try: | 611 try: |
612 return entry['{}_xhtml'.format(key)] | 612 return fixXHTMLLinks(entry['{}_xhtml'.format(key)]) |
613 except KeyError: | 613 except KeyError: |
614 try: | 614 try: |
615 processor = addURLToText if key.startswith('content') else sanitizeHtml | 615 processor = addURLToText if key.startswith('content') else sanitizeHtml |
616 return convertNewLinesToXHTML(processor(entry[key])) | 616 return convertNewLinesToXHTML(processor(entry[key])) |
617 except KeyError: | 617 except KeyError: |