Mercurial > libervia-pubsub
changeset 314:1e546442b81a
backend (getItems): minor refactoring of extenstion callback loop, as it is used only for RSM and it is not efficient. Need to be moved in an other module
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 03 Jan 2016 18:33:22 +0100 |
parents | e8e1ca94fd8c |
children | 720d73e30bf7 |
files | sat_pubsub/backend.py |
diffstat | 1 files changed, 10 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_pubsub/backend.py Sun Jan 03 18:33:20 2016 +0100 +++ b/sat_pubsub/backend.py Sun Jan 03 18:33:22 2016 +0100 @@ -643,13 +643,15 @@ d.addCallback(self._tuple2ItemData) d.addCallback(append_item_config) - for extension in ext_data: - if ext_data[extension] is not None: - if hasattr(self, '_items_%s' % extension): - method = getattr(self, '_items_%s' % extension) - d.addCallback(method, node, authorized_groups, - unrestricted, maxItems, itemIdentifiers, - ext_data[extension]) + try: + rsm_data = ext_data['rsm'] + except KeyError: + pass + else: + if rsm_data is not None: + d.addCallback(self._items_rsm, node, authorized_groups, + unrestricted, maxItems, itemIdentifiers, + rsm_data) return d if not ILeafNode.providedBy(node): @@ -680,6 +682,7 @@ def _items_rsm(self, elts, node, authorized_groups, unrestricted, maxItems, itemIdentifiers, request): + # FIXME: move this to a separate module ? response = rsm.RSMResponse() d_count = node.countItems(authorized_groups, unrestricted)