Mercurial > libervia-pubsub
comparison 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 |
comparison
equal
deleted
inserted
replaced
319:a51947371625 | 320:29c2553ef863 |
---|---|
559 return self.storage.getAffiliations(entity) | 559 return self.storage.getAffiliations(entity) |
560 | 560 |
561 | 561 |
562 def getItems(self, nodeIdentifier, recipient, maxItems=None, | 562 def getItems(self, nodeIdentifier, recipient, maxItems=None, |
563 itemIdentifiers=None, ext_data=None): | 563 itemIdentifiers=None, ext_data=None): |
564 d = self.getItemsData(nodeIdentifier, recipient, maxItems, itemIdentifiers, ext_data) | |
565 d.addCallback(lambda items_data: [item_data.item for item_data in items_data]) | |
566 return d | |
567 | |
568 def getItemsData(self, nodeIdentifier, recipient, maxItems=None, | |
569 itemIdentifiers=None, ext_data=None): | |
570 """like getItems but return the whole ItemData""" | |
564 if ext_data is None: | 571 if ext_data is None: |
565 ext_data = {} | 572 ext_data = {} |
566 d = self.storage.getNode(nodeIdentifier, ext_data.get('pep', False), recipient) | 573 d = self.storage.getNode(nodeIdentifier, ext_data.get('pep', False), recipient) |
567 d.addCallback(_getAffiliation, recipient) | 574 d.addCallback(_getAffiliation, recipient) |
568 d.addCallback(self._doGetItems, recipient, maxItems, itemIdentifiers, | 575 d.addCallback(self._doGetItems, recipient, maxItems, itemIdentifiers, |
662 d.addCallback(access_checked) | 669 d.addCallback(access_checked) |
663 elif access_model == const.VAL_AMODEL_ROSTER: | 670 elif access_model == const.VAL_AMODEL_ROSTER: |
664 d.addCallback(self._getNodeGroups, node.nodeIdentifier, ext_data.get('pep', False)) | 671 d.addCallback(self._getNodeGroups, node.nodeIdentifier, ext_data.get('pep', False)) |
665 d.addCallback(self.checkGroup, requestor) | 672 d.addCallback(self.checkGroup, requestor) |
666 d.addCallback(access_checked) | 673 d.addCallback(access_checked) |
667 | |
668 d.addCallback(lambda items_data: [item_data.item for item_data in items_data]) | |
669 | 674 |
670 return d | 675 return d |
671 | 676 |
672 def _setCount(self, value, response): | 677 def _setCount(self, value, response): |
673 response.count = value | 678 response.count = value |