comparison sat_frontends/jp/cmd_ticket.py @ 3309:71761e9fb984

plugins tickets, merge-requests: `ticketsGet` and `mergeRequestsGet` serialisation: those methods now return data serialised with `data_format.serialise`
author Goffi <goffi@goffi.org>
date Thu, 16 Jul 2020 09:07:26 +0200
parents 559a625a236b
children
comparison
equal deleted inserted replaced
3308:384283adcce1 3309:71761e9fb984
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 20
21 from . import base 21 import json
22 import os
22 from sat.core.i18n import _ 23 from sat.core.i18n import _
24 from sat.tools.common import data_format
23 from sat_frontends.jp import common 25 from sat_frontends.jp import common
24 from sat_frontends.jp.constants import Const as C 26 from sat_frontends.jp.constants import Const as C
25 import json 27 from . import base
26 import os
27 28
28 __commands__ = ["Ticket"] 29 __commands__ = ["Ticket"]
29 30
30 FIELDS_MAP = "mapping" 31 FIELDS_MAP = "mapping"
31 32
48 pass 49 pass
49 50
50 async def start(self): 51 async def start(self):
51 await common.fill_well_known_uri(self, os.getcwd(), "tickets", meta_map={}) 52 await common.fill_well_known_uri(self, os.getcwd(), "tickets", meta_map={})
52 try: 53 try:
53 tickets_data = await self.host.bridge.ticketsGet( 54 tickets_data = data_format.deserialise(
54 self.args.service, 55 await self.host.bridge.ticketsGet(
55 self.args.node, 56 self.args.service,
56 self.args.max, 57 self.args.node,
57 self.args.items, 58 self.args.max,
58 "", 59 self.args.items,
59 self.getPubsubExtra(), 60 "",
60 self.profile, 61 self.getPubsubExtra(),
62 self.profile,
63 ),
64 type_check=list
61 ) 65 )
62 except Exception as e: 66 except Exception as e:
63 self.disp(f"can't get tickets: {e}", error=True) 67 self.disp(f"can't get tickets: {e}", error=True)
64 self.host.quit(C.EXIT_BRIDGE_ERRBACK) 68 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
65 else: 69 else: