Mercurial > libervia-pubsub
diff 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 |
line wrap: on
line diff
--- a/src/backend.py Fri Feb 15 15:56:30 2019 +0100 +++ b/src/backend.py Fri Feb 15 16:31:38 2019 +0100 @@ -395,12 +395,14 @@ if not item.getAttribute("id"): item["id"] = yield node.getNextId() new_item = True - ret_pubsub_elt = domish.Element((pubsub.NS_PUBSUB, u'pubsub')) - ret_publish_elt = ret_pubsub_elt.addElement(u'publish') - ret_publish_elt[u'node'] = node.nodeIdentifier + if ret_payload is None: + ret_pubsub_elt = domish.Element((pubsub.NS_PUBSUB, u'pubsub')) + ret_publish_elt = ret_pubsub_elt.addElement(u'publish') + ret_publish_elt[u'node'] = node.nodeIdentifier + ret_payload = ret_pubsub_elt + ret_publish_elt = ret_payload.publish ret_item_elt = ret_publish_elt.addElement(u'item') ret_item_elt["id"] = item[u"id"] - ret_payload = ret_pubsub_elt else: check_overwrite = True new_item = False