Mercurial > libervia-pubsub
comparison sat_pubsub/backend.py @ 437:454f61a32427
backend: fixed item retractation notification
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 08 Feb 2021 19:01:29 +0100 |
parents | 5e8b8ef5c862 |
children | b5e1e8d93dd4 |
comparison
equal
deleted
inserted
replaced
436:80aca1cf1543 | 437:454f61a32427 |
---|---|
1203 raise error.Forbidden() | 1203 raise error.Forbidden() |
1204 | 1204 |
1205 items_data = await node.getItemsById(None, True, itemIdentifiers) | 1205 items_data = await node.getItemsById(None, True, itemIdentifiers) |
1206 # Remove the items and keep only actually removed ones in items_data | 1206 # Remove the items and keep only actually removed ones in items_data |
1207 removed = await node.removeItems(itemIdentifiers) | 1207 removed = await node.removeItems(itemIdentifiers) |
1208 retracted_items = [ | 1208 retracted_items_data = [ |
1209 item_data for item_data in items_data if item_data.item["id"] in removed | 1209 item_data for item_data in items_data if item_data.item["id"] in removed |
1210 ] | 1210 ] |
1211 if nodeIdentifier.startswith(const.FDP_TEMPLATE_PREFIX): | 1211 if nodeIdentifier.startswith(const.FDP_TEMPLATE_PREFIX): |
1212 app_ns = nodeIdentifier[len(const.FDP_TEMPLATE_PREFIX):] | 1212 app_ns = nodeIdentifier[len(const.FDP_TEMPLATE_PREFIX):] |
1213 submitted_node_id = f"{const.FDP_SUBMITTED_PREFIX}{app_ns}" | 1213 submitted_node_id = f"{const.FDP_SUBMITTED_PREFIX}{app_ns}" |
1230 nodeIdentifier, pep, recipient) | 1230 nodeIdentifier, pep, recipient) |
1231 if submitted_node is not None: | 1231 if submitted_node is not None: |
1232 submitted_node.setSchema(current_schema) | 1232 submitted_node.setSchema(current_schema) |
1233 | 1233 |
1234 if notify: | 1234 if notify: |
1235 await self._doNotifyRetraction(retracted_items, node, pep, recipient) | 1235 self._doNotifyRetraction(retracted_items_data, node, pep, recipient) |
1236 | 1236 |
1237 return retracted_items | 1237 return [r.item for r in retracted_items_data] |
1238 | 1238 |
1239 def _doNotifyRetraction(self, items_data, node, pep, recipient): | 1239 def _doNotifyRetraction(self, items_data, node, pep, recipient): |
1240 self.dispatch({'items_data': items_data, | 1240 self.dispatch({'items_data': items_data, |
1241 'node': node, | 1241 'node': node, |
1242 'pep': pep, | 1242 'pep': pep, |