# HG changeset patch # User Goffi # Date 1718886969 -7200 # Node ID a5d27f69eedb23303032c5fe2798bbef820f34b6 # Parent 0d7bb4df2343b8999dbd013fb2b982fffdb55ae0 plugin misc list: Comments node creation can now be specified with `comments` field in `extra`. diff -r 0d7bb4df2343 -r a5d27f69eedb libervia/backend/plugins/plugin_misc_lists.py --- a/libervia/backend/plugins/plugin_misc_lists.py Wed Jun 19 18:44:57 2024 +0200 +++ b/libervia/backend/plugins/plugin_misc_lists.py Thu Jun 20 14:36:09 2024 +0200 @@ -322,13 +322,23 @@ @param extra(dict, None): same as for [XEP-0060.send_item] with additional keys: - update(bool): if True, get previous item data to merge with current one if True, item_id must be set + - comments(bool): indicate if a new comment node must be created. + If True a new comment node will be create, and replace existing one if + there is already one. + If not set, comment node will be create if not ``item_id`` is specified, + and won't be modified otherwise. other arguments are same as for [self._s.send_data_form_item] @return (unicode): id of the created item """ if not node: node = self.namespace - if not item_id: + if extra is None: + extra = {} + + # FIXME: presence of a field where comments node can be added must be checked. + add_comments_node = extra.get("comments") + if add_comments_node or (add_comments_node is None and not item_id): comments_service = await self._m.get_comments_service(client, service) # we need to use uuid for comments node, because we don't know item id in