changeset 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 a51947371625
children c7fe09894952
files sat_pubsub/backend.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
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):