comparison libervia/pages/blog/view/page_meta.py @ 1156:3048bd137aaf

server, browser: changed blog items serialisation following changes in backend
author Goffi <goffi@goffi.org>
date Sat, 23 Feb 2019 21:03:21 +0100
parents 29eb15062416
children 469d0de8da0e
comparison
equal deleted inserted replaced
1155:813d54af8c0c 1156:3048bd137aaf
1 #!/usr/bin/env python2.7 1 #!/usr/bin/env python2.7
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 import unicodedata
4 import re
5 import cgi
3 from libervia.server.constants import Const as C 6 from libervia.server.constants import Const as C
4 from twisted.words.protocols.jabber import jid 7 from twisted.words.protocols.jabber import jid
5 from twisted.internet import defer 8 from twisted.internet import defer
6 from sat.tools.common import data_objects 9 from sat.tools.common import data_objects
7 from libervia.server import session_iface 10 from libervia.server import session_iface
8 from sat.core.i18n import _ 11 from sat.core.i18n import _
9 from sat.tools.common.template import safe 12 from sat.tools.common.template import safe
10 from sat.tools.common import uri 13 from sat.tools.common import uri
14 from sat.tools.common import data_format
11 from libervia.server import utils 15 from libervia.server import utils
12 import unicodedata
13 import re
14 import cgi
15 from sat.core.log import getLogger 16 from sat.core.log import getLogger
17
16 log = getLogger(__name__) 18 log = getLogger(__name__)
17 19
18 """generic blog (with service/node provided)""" 20 """generic blog (with service/node provided)"""
19 name = u'blog_view' 21 name = u'blog_view'
20 template = u"blog/articles.html" 22 template = u"blog/articles.html"
274 276
275 if not body: 277 if not body:
276 self.pageError(request, C.HTTP_BAD_REQUEST) 278 self.pageError(request, C.HTTP_BAD_REQUEST)
277 comment_data = {u"content": body} 279 comment_data = {u"content": body}
278 try: 280 try:
279 yield self.host.bridgeCall(u'mbSend', service, node, comment_data, profile) 281 yield self.host.bridgeCall(u'mbSend',
282 service,
283 node,
284 data_format.serialise(comment_data),
285 profile)
280 except Exception as e: 286 except Exception as e:
281 if u"forbidden" in unicode(e): 287 if u"forbidden" in unicode(e):
282 self.pageError(request, 401) 288 self.pageError(request, 401)
283 else: 289 else:
284 raise e 290 raise e