plugins tickets, merge-requests: ticketsGet and mergeRequestsGet serialisation:
those methods now return data serialised with `data_format.serialise`
This commit is contained in:
parent
e03eb5bfcc
commit
95096df52f
1 changed files with 71 additions and 57 deletions
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
# SAT plugin for Pubsub Schemas
|
||||
# Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org)
|
||||
|
||||
|
|
@ -535,6 +534,7 @@ class PubsubSchema(object):
|
|||
filters=filters,
|
||||
)
|
||||
d.addCallback(self._p.transItemsData)
|
||||
d.addCallback(lambda data: data_format.serialise(data))
|
||||
return d
|
||||
|
||||
def prepareBridgeSet(self, service, node, schema, item_id, extra, profile_key):
|
||||
|
|
@ -601,7 +601,7 @@ class PubsubSchema(object):
|
|||
client, service, node, schema, item_id, extra = self.prepareBridgeSet(
|
||||
service, node, schema, item_id, extra
|
||||
)
|
||||
d = self.set(
|
||||
d = defer.ensureDeferred(self.set(
|
||||
client,
|
||||
service,
|
||||
node,
|
||||
|
|
@ -613,12 +613,12 @@ class PubsubSchema(object):
|
|||
form_ns=form_ns,
|
||||
default_node=default_node,
|
||||
fill_author=fill_author,
|
||||
)
|
||||
))
|
||||
d.addCallback(lambda ret: ret or "")
|
||||
return d
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def set(self, client, service, node, values, schema, item_id, extra, deserialise,
|
||||
async def set(
|
||||
self, client, service, node, values, schema, item_id, extra, deserialise,
|
||||
form_ns, default_node=None, fill_author=True):
|
||||
"""Set an item in a node with a schema
|
||||
|
||||
|
|
@ -651,19 +651,19 @@ class PubsubSchema(object):
|
|||
raise exceptions.DataError(
|
||||
_('if extra["update"] is set, item_id must be set too')
|
||||
)
|
||||
yield self.copyMissingValues(client, service, node, item_id, form_ns, values)
|
||||
await self.copyMissingValues(client, service, node, item_id, form_ns, values)
|
||||
|
||||
values["updated"] = now
|
||||
if fill_author:
|
||||
if not values.get("author"):
|
||||
id_data = yield self._i.getIdentity(client, None, ["nicknames"])
|
||||
id_data = await self._i.getIdentity(client, None, ["nicknames"])
|
||||
values["author"] = id_data['nicknames'][0]
|
||||
if not values.get("author_jid"):
|
||||
values["author_jid"] = client.jid.full()
|
||||
item_id = yield self.sendDataFormItem(
|
||||
item_id = await self.sendDataFormItem(
|
||||
client, service, node, values, schema, item_id, extra, deserialise
|
||||
)
|
||||
defer.returnValue(item_id)
|
||||
return item_id
|
||||
|
||||
|
||||
@implementer(iwokkel.IDisco)
|
||||
|
|
|
|||
Loading…
Reference in a new issue