diff sat_pubsub/backend.py @ 320:29c2553ef863

added getItemsData to get list of ItemData instead of only the list of domish.Element
author Goffi <goffi@goffi.org>
date Sun, 03 Jan 2016 18:33:23 +0100
parents d13526c0eb32
children 82d1259b3e36
line wrap: on
line diff
--- a/sat_pubsub/backend.py	Sun Jan 03 18:33:22 2016 +0100
+++ b/sat_pubsub/backend.py	Sun Jan 03 18:33:23 2016 +0100
@@ -561,6 +561,13 @@
 
     def getItems(self, nodeIdentifier, recipient, maxItems=None,
                        itemIdentifiers=None, ext_data=None):
+        d = self.getItemsData(nodeIdentifier, recipient, maxItems, itemIdentifiers, ext_data)
+        d.addCallback(lambda items_data: [item_data.item for item_data in items_data])
+        return d
+
+    def getItemsData(self, nodeIdentifier, recipient, maxItems=None,
+                       itemIdentifiers=None, ext_data=None):
+        """like getItems but return the whole ItemData"""
         if ext_data is None:
             ext_data = {}
         d = self.storage.getNode(nodeIdentifier, ext_data.get('pep', False), recipient)
@@ -665,8 +672,6 @@
             d.addCallback(self.checkGroup, requestor)
             d.addCallback(access_checked)
 
-        d.addCallback(lambda items_data: [item_data.item for item_data in items_data])
-
         return d
 
     def _setCount(self, value, response):