changeset 84:896e76caa204

wokkel (rsm): fix Pubsub service: - properly get RSM response from `items` return value - add RSM handler in `items` workflow
author Goffi <goffi@goffi.org>
date Tue, 25 Jan 2022 18:53:06 +0100
parents 2d99519090b9
children ba3f695fff34
files sat_tmp/wokkel/rsm.py
diffstat 1 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/sat_tmp/wokkel/rsm.py	Wed Dec 01 17:22:14 2021 +0100
+++ b/sat_tmp/wokkel/rsm.py	Tue Jan 25 18:53:06 2022 +0100
@@ -414,18 +414,15 @@
 
     _request_class = PubSubRequest
 
-    def _toResponse_items(self, elts, resource, request):
-        # default method only manage <item/> elements
-        # but we need to add RSM set element
-        rsm_elt = None
-        for idx, elt in enumerate(reversed(elts)):
-            if elt.name == "set" and elt.uri == NS_RSM:
-                rsm_elt = elts.pop(-1-idx)
-                break
+    def _toResponse_items(self, resp_tuple, resource, request):
+        elts, rsm_response = resp_tuple
 
         response = pubsub.PubSubService._toResponse_items(self, elts,
                                                           resource, request)
-        if rsm_elt is not None:
-            response.addChild(rsm_elt)
+        if rsm_response is not None:
+            response.addChild(rsm_response.toElement())
 
         return response
+
+
+PubSubService._legacyHandlers["items"][1].append("rsm")