changeset 3549:3fd60beb9b92

plugin forums: use serialised data for extra in forumTopicsGet
author Goffi <goffi@goffi.org>
date Sun, 06 Jun 2021 19:35:19 +0200
parents 13e7ef106589
children 7df12ffa6620
files sat/plugins/plugin_misc_forums.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_forums.py	Fri Jun 04 17:18:44 2021 +0200
+++ b/sat/plugins/plugin_misc_forums.py	Sun Jun 06 19:35:19 2021 +0200
@@ -21,7 +21,7 @@
 from sat.core.constants import Const as C
 from sat.core import exceptions
 from sat.core.log import getLogger
-from sat.tools.common import uri
+from sat.tools.common import uri, data_format
 from twisted.words.protocols.jabber import jid
 from twisted.words.xish import domish
 from twisted.internet import defer
@@ -73,7 +73,7 @@
                               method=self._set,
                               async_=True)
         host.bridge.addMethod("forumTopicsGet", ".plugin",
-                              in_sign='ssa{ss}s', out_sign='(aa{ss}a{ss})',
+                              in_sign='ssa{ss}s', out_sign='(aa{ss}s)',
                               method=self._getTopics,
                               async_=True)
         host.bridge.addMethod("forumTopicCreate", ".plugin",
@@ -249,7 +249,9 @@
         client = self.host.getClient(profile_key)
         extra = self._p.parseExtra(extra)
         d = self.getTopics(client, jid.JID(service), node, rsm_request=extra.rsm_request, extra=extra.extra)
-        d.addCallback(lambda topics_metadata: (topics_metadata[0], {k: str(v) for k,v in topics_metadata[1].items()}))
+        d.addCallback(
+            lambda topics_data: (topics_data[0], data_format.serialise(topics_data[1]))
+        )
         return d
 
     @defer.inlineCallbacks