diff sat_pubsub/mam.py @ 431:5e8b8ef5c862

implentation of XEP-0346 (Form Discovery and Publishing): The former non standard node schema has been replaced by XEP-0346 which uses 2 nodes (one from schema/template and one for submitted values). The implementation is an adapation of the former one, and data validation is still done even if this is not currently specified in any XEP. When the template node is modified, the change is reflected in the node schema.
author Goffi <goffi@goffi.org>
date Fri, 11 Dec 2020 17:19:00 +0100
parents ccb2a22ea0fc
children 91da42d44ea2
line wrap: on
line diff
--- a/sat_pubsub/mam.py	Fri Dec 11 17:18:52 2020 +0100
+++ b/sat_pubsub/mam.py	Fri Dec 11 17:19:00 2020 +0100
@@ -29,6 +29,7 @@
 
 from twisted.words.xish import domish
 from twisted.python import log
+from twisted.internet import defer
 from twisted.words.protocols.jabber import error
 
 from sat_pubsub import const
@@ -88,8 +89,10 @@
         if mam_request.orderBy:
             ext_data['order_by'] = mam_request.orderBy
 
-        d = self.backend.getItemsData(mam_request.node, mam_request.sender,
+        d = defer.ensureDeferred(
+            self.backend.getItemsData(mam_request.node, mam_request.sender,
                                       mam_request.recipient, None, None, ext_data)
+        )
 
         def make_message(elt):
             # XXX: http://xmpp.org/extensions/xep-0297.html#sect-idp629952 (rule 3)