Mercurial > libervia-pubsub
comparison src/backend.py @ 389:66128656f76c
backend: fixed items returned on publishing:
when generating several item ids at once, only the last id was returned.
This patch fixes it by returning an item with filled id for each generated item.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 15 Feb 2019 16:31:38 +0100 |
parents | 1c13ba86a421 |
children | 3fb2ff438f09 |
comparison
equal
deleted
inserted
replaced
388:1c13ba86a421 | 389:66128656f76c |
---|---|
393 item.uri = None | 393 item.uri = None |
394 item.defaultUri = None | 394 item.defaultUri = None |
395 if not item.getAttribute("id"): | 395 if not item.getAttribute("id"): |
396 item["id"] = yield node.getNextId() | 396 item["id"] = yield node.getNextId() |
397 new_item = True | 397 new_item = True |
398 ret_pubsub_elt = domish.Element((pubsub.NS_PUBSUB, u'pubsub')) | 398 if ret_payload is None: |
399 ret_publish_elt = ret_pubsub_elt.addElement(u'publish') | 399 ret_pubsub_elt = domish.Element((pubsub.NS_PUBSUB, u'pubsub')) |
400 ret_publish_elt[u'node'] = node.nodeIdentifier | 400 ret_publish_elt = ret_pubsub_elt.addElement(u'publish') |
401 ret_publish_elt[u'node'] = node.nodeIdentifier | |
402 ret_payload = ret_pubsub_elt | |
403 ret_publish_elt = ret_payload.publish | |
401 ret_item_elt = ret_publish_elt.addElement(u'item') | 404 ret_item_elt = ret_publish_elt.addElement(u'item') |
402 ret_item_elt["id"] = item[u"id"] | 405 ret_item_elt["id"] = item[u"id"] |
403 ret_payload = ret_pubsub_elt | |
404 else: | 406 else: |
405 check_overwrite = True | 407 check_overwrite = True |
406 new_item = False | 408 new_item = False |
407 access_model, item_config = self.parseItemConfig(item) | 409 access_model, item_config = self.parseItemConfig(item) |
408 categories = self.parseCategories(item) | 410 categories = self.parseCategories(item) |