# HG changeset patch # User Goffi # Date 1547894342 -3600 # Node ID f18d8315929e73487d5c65a279b1e53556fe239c # Parent 76ebecdb9b1e7bfeca1bb75ee452ae0762471c3c merge_requests: use XHTML for body diff -r 76ebecdb9b1e -r f18d8315929e sat/plugins/plugin_misc_merge_requests.py --- a/sat/plugins/plugin_misc_merge_requests.py Sat Jan 19 11:39:02 2019 +0100 +++ b/sat/plugins/plugin_misc_merge_requests.py Sat Jan 19 11:39:02 2019 +0100 @@ -34,7 +34,7 @@ C.PI_IMPORT_NAME: "MERGE_REQUESTS", C.PI_TYPE: "EXP", C.PI_PROTOCOLS: [], - C.PI_DEPENDENCIES: ["XEP-0060", "PUBSUB_SCHEMA", "TICKETS"], + C.PI_DEPENDENCIES: ["XEP-0060", "PUBSUB_SCHEMA", "TICKETS", "TEXT_SYNTAXES"], C.PI_MAIN: "MergeRequests", C.PI_HANDLER: "no", C.PI_DESCRIPTION: _("""Merge requests management plugin""") @@ -67,9 +67,9 @@ log.info(_(u"Merge requests plugin initialization")) self.host = host host.registerNamespace('merge_requests', NS_MERGE_REQUESTS) - self._p = self.host.plugins["XEP-0060"] - self._s = self.host.plugins["PUBSUB_SCHEMA"] - self._t = self.host.plugins["TICKETS"] + self._p = self.host.plugins[u"XEP-0060"] + self._s = self.host.plugins[u"PUBSUB_SCHEMA"] + self._t = self.host.plugins[u"TICKETS"] self._handlers = {} self._handlers_list = [] # handlers sorted by priority self._type_handlers = {} # data type => handler map @@ -259,7 +259,14 @@ if not values.get(u'title'): values[u'title'] = msg_lines[0] if not values.get(u'body'): - values[u'body'] = u'\n'.join(msg_lines[1:]) + ts = self.host.plugins['TEXT_SYNTAXES'] + xhtml = yield ts.convert( + u'\n'.join(msg_lines[1:]), + syntax_from = ts.SYNTAX_TEXT, + syntax_to = ts.SYNTAX_XHTML, + profile = client.profile) + values[u'body'] = '
{xhtml}
'.format( + ns=C.NS_XHTML, xhtml=xhtml) values[FIELD_DATA] = data diff -r 76ebecdb9b1e -r f18d8315929e sat/plugins/plugin_misc_tickets.py --- a/sat/plugins/plugin_misc_tickets.py Sat Jan 19 11:39:02 2019 +0100 +++ b/sat/plugins/plugin_misc_tickets.py Sat Jan 19 11:39:02 2019 +0100 @@ -83,16 +83,8 @@ async=True, ) - def _set( - self, - service, - node, - values, - schema=None, - item_id=None, - extra=None, - profile_key=C.PROF_KEY_NONE, - ): + def _set(self, service, node, values, schema=None, item_id=None, extra=None, + profile_key=C.PROF_KEY_NONE): client, service, node, schema, item_id, extra = self._s.prepareBridgeSet( service, node, schema, item_id, extra, profile_key ) @@ -103,18 +95,8 @@ return d @defer.inlineCallbacks - def set( - self, - client, - service, - node, - values, - schema=None, - item_id=None, - extra=None, - deserialise=False, - form_ns=NS_TICKETS, - ): + def set(self, client, service, node, values, schema=None, item_id=None, extra=None, + deserialise=False, form_ns=NS_TICKETS): """Publish a tickets @param node(unicode, None): Pubsub node to use @@ -135,9 +117,9 @@ if not item_id: comments_service = yield self._m.getCommentsService(client, service) - # we need to use uuid for comments node, because we don't know item id in advance - # (we don't want to set it ourselves to let the server choose, so we can have - # a nicer id if serial ids is activated) + # we need to use uuid for comments node, because we don't know item id in + # advance (we don't want to set it ourselves to let the server choose, so we + # can have a nicer id if serial ids is activated) comments_node = self._m.getCommentsNode( node + u"_" + unicode(shortuuid.uuid()) )