plugin XEP-0060: getItems extra is now serialised dict

This commit is contained in:
Goffi 2021-07-28 23:01:15 +02:00
commit f2a06bbcbf
4 changed files with 32 additions and 31 deletions

View file

@ -41,6 +41,7 @@ from sat.tools.common import dynamic_import
from sat.tools.common import uri
from sat.tools.common import date_utils
from sat.tools.common import utils
from sat.tools.common import data_format
from sat.tools.common.ansi import ANSI as A
from sat.core import exceptions
import sat_frontends.jp
@ -1189,11 +1190,11 @@ class CommandBase(object):
_('trying to use output when use_output has not been set'))
return self.host.output(output_type, self.args.output, self.extra_outputs, data)
def getPubsubExtra(self, extra=None):
def getPubsubExtra(self, extra: Optional[dict] = None) -> str:
"""Helper method to compute extra data from pubsub arguments
@param extra(None, dict): base extra dict, or None to generate a new one
@return (dict): dict which can be used directly in the bridge for pubsub
@param extra: base extra dict, or None to generate a new one
@return: dict which can be used directly in the bridge for pubsub
"""
if extra is None:
extra = {}
@ -1234,7 +1235,7 @@ class CommandBase(object):
else:
if order_by is not None:
extra[C.KEY_ORDER_BY] = self.args.order_by
return extra
return data_format.serialise(extra)
def add_parser_options(self):
try:

View file

@ -600,7 +600,9 @@ class Edit(base.CommandBase, BlogPublishCommon, common.BaseEdit):
items = [item] if item else []
mb_data = data_format.deserialise(
await self.host.bridge.mbGet(service, node, 1, items, {}, self.profile)
await self.host.bridge.mbGet(
service, node, 1, items, data_format.serialise({}), self.profile
)
)
item = mb_data["items"][0]

View file

@ -139,7 +139,7 @@ class Get(base.CommandBase):
self.args.max,
self.args.items,
"",
extra,
data_format.serialise(extra),
self.profile,
)
)

View file

@ -955,7 +955,7 @@ class Edit(base.CommandBase, common.BaseEdit):
items = [item] if item else []
ps_result = data_format.deserialise(
await self.host.bridge.psItemsGet(
service, node, 1, items, "", {}, self.profile
service, node, 1, items, "", data_format.serialise({}), self.profile
)
)
item_raw = ps_result["items"][0]
@ -1687,7 +1687,7 @@ class Transform(base.CommandBase):
self.args.rsm_max,
self.args.items,
"",
extra,
data_format.serialise(extra),
self.profile,
)
)