changeset 14:1de25b1f609f

tmp (wokkel): fixes RSM implementation to fit sat_pubsub answer when in "unrestricted" mode
author souliane <souliane@mailoo.org>
date Thu, 10 Sep 2015 07:33:13 +0200
parents 22f0cb2fa793
children 9019d6cbaf0e
files wokkel/pubsub.py wokkel/rsm.py
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/wokkel/pubsub.py	Sun Aug 16 00:06:12 2015 +0200
+++ b/wokkel/pubsub.py	Thu Sep 10 07:33:13 2015 +0200
@@ -1408,6 +1408,9 @@
         items["node"] = request.nodeIdentifier
 
         for item in result:
+            if isinstance(item, tuple):
+                # XXX: see sat_pubsub.pgsql_storage.LeafNode.getItemsById return value
+                item = item[0]
             if item.name == 'item':
                 item.uri = NS_PUBSUB
                 items.addChild(item)
--- a/wokkel/rsm.py	Sun Aug 16 00:06:12 2015 +0200
+++ b/wokkel/rsm.py	Thu Sep 10 07:33:13 2015 +0200
@@ -368,9 +368,12 @@
     def _toResponse_items(self, result, resource, request):
         response = pubsub.PubSubService._toResponse_items(self, result,
                                                           resource, request)
-        set_elts = [elt for elt in result if elt.name == 'set']
-        if set_elts:
-            assert len(set_elts) == 1
-            response.addChild(set_elts[0])
+        for item in result:
+            if isinstance(item, tuple):
+                # XXX: see sat_pubsub.pgsql_storage.LeafNode.getItemsById return value
+                item = item[0]
+            if item.name == set:
+                response.addChild(item)
+                break
 
         return response