From b6eb5a83f510d28918d98a1a1e55e1a207fdd359 Mon Sep 17 00:00:00 2001 From: Goffi Date: Thu, 4 Feb 2021 21:05:21 +0100 Subject: [PATCH] plugin tickets, merge_requests: renamed "tickets" feature to "lists": this feature is more generic than only "tickets" for technical stuff, thus the name "lists" seems more appropriate. --- ...n_misc_tickets.py => plugin_misc_lists.py} | 22 ++++++++++--------- sat/plugins/plugin_misc_merge_requests.py | 2 +- .../jp/{cmd_ticket.py => cmd_list.py} | 18 +++++++-------- 3 files changed, 22 insertions(+), 20 deletions(-) rename sat/plugins/{plugin_misc_tickets.py => plugin_misc_lists.py} (92%) rename sat_frontends/jp/{cmd_ticket.py => cmd_list.py} (94%) diff --git a/sat/plugins/plugin_misc_tickets.py b/sat/plugins/plugin_misc_lists.py similarity index 92% rename from sat/plugins/plugin_misc_tickets.py rename to sat/plugins/plugin_misc_lists.py index 1a8e42fa..5abb66d3 100644 --- a/sat/plugins/plugin_misc_tickets.py +++ b/sat/plugins/plugin_misc_lists.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from sat.core.i18n import _ +from sat.core.i18n import _, D_ from sat.core.constants import Const as C from twisted.internet import defer from sat.tools.common import uri @@ -24,24 +24,26 @@ from sat.core.log import getLogger log = getLogger(__name__) +# XXX: this plugin was formely named "tickets", thus the namespace keeps this +# name APP_NS_TICKETS = "org.salut-a-toi.tickets:0" PLUGIN_INFO = { - C.PI_NAME: _("Tickets management"), - C.PI_IMPORT_NAME: "TICKETS", + C.PI_NAME: _("Pubsub Lists"), + C.PI_IMPORT_NAME: "LISTS", C.PI_TYPE: "EXP", C.PI_PROTOCOLS: [], C.PI_DEPENDENCIES: ["XEP-0060", "XEP-0346", "XEP-0277", "IDENTITY"], - C.PI_MAIN: "Tickets", + C.PI_MAIN: "PubsubLists", C.PI_HANDLER: "no", - C.PI_DESCRIPTION: _("""Tickets management plugin"""), + C.PI_DESCRIPTION: _("""Pubsub lists management plugin"""), } -class Tickets: +class PubsubLists: def __init__(self, host): - log.info(_("Tickets plugin initialization")) + log.info(_("Pubsub lists plugin initialization")) self.host = host self._s = self.host.plugins["XEP-0346"] self.namespace = self._s.getSubmittedNS(APP_NS_TICKETS) @@ -49,7 +51,7 @@ class Tickets: self._p = self.host.plugins["XEP-0060"] self._m = self.host.plugins["XEP-0277"] host.bridge.addMethod( - "ticketsGet", + "listGet", ".plugin", in_sign="ssiassa{ss}s", out_sign="s", @@ -72,7 +74,7 @@ class Tickets: async_=True, ) host.bridge.addMethod( - "ticketSet", + "listSet", ".plugin", in_sign="ssa{sas}ssss", out_sign="s", @@ -80,7 +82,7 @@ class Tickets: async_=True, ) host.bridge.addMethod( - "ticketsSchemaGet", + "listSchemaGet", ".plugin", in_sign="sss", out_sign="s", diff --git a/sat/plugins/plugin_misc_merge_requests.py b/sat/plugins/plugin_misc_merge_requests.py index f85db12c..2d7ccee4 100644 --- a/sat/plugins/plugin_misc_merge_requests.py +++ b/sat/plugins/plugin_misc_merge_requests.py @@ -36,7 +36,7 @@ PLUGIN_INFO = { C.PI_IMPORT_NAME: "MERGE_REQUESTS", C.PI_TYPE: "EXP", C.PI_PROTOCOLS: [], - C.PI_DEPENDENCIES: ["XEP-0060", "XEP-0346", "TICKETS", "TEXT_SYNTAXES"], + C.PI_DEPENDENCIES: ["XEP-0060", "XEP-0346", "LISTS", "TEXT_SYNTAXES"], C.PI_MAIN: "MergeRequests", C.PI_HANDLER: "no", C.PI_DESCRIPTION: _("""Merge requests management plugin""") diff --git a/sat_frontends/jp/cmd_ticket.py b/sat_frontends/jp/cmd_list.py similarity index 94% rename from sat_frontends/jp/cmd_ticket.py rename to sat_frontends/jp/cmd_list.py index 2e5e6772..176db8c7 100644 --- a/sat_frontends/jp/cmd_ticket.py +++ b/sat_frontends/jp/cmd_list.py @@ -26,7 +26,7 @@ from sat_frontends.jp import common from sat_frontends.jp.constants import Const as C from . import base -__commands__ = ["Ticket"] +__commands__ = ["List"] FIELDS_MAP = "mapping" @@ -42,7 +42,7 @@ class Get(base.CommandBase): pubsub_flags={C.MULTI_ITEMS}, pubsub_defaults={"service": _("auto"), "node": _("auto")}, use_output=C.OUTPUT_LIST_XMLUI, - help=_("get tickets"), + help=_("get lists"), ) def add_parser_options(self): @@ -51,8 +51,8 @@ class Get(base.CommandBase): async def start(self): await common.fill_well_known_uri(self, os.getcwd(), "tickets", meta_map={}) try: - tickets_data = data_format.deserialise( - await self.host.bridge.ticketsGet( + lists_data = data_format.deserialise( + await self.host.bridge.listGet( self.args.service, self.args.node, self.args.max, @@ -64,10 +64,10 @@ class Get(base.CommandBase): type_check=list ) except Exception as e: - self.disp(f"can't get tickets: {e}", error=True) + self.disp(f"can't get lists: {e}", error=True) self.host.quit(C.EXIT_BRIDGE_ERRBACK) else: - await self.output(tickets_data[0]) + await self.output(lists_data[0]) self.host.quit(C.EXIT_OK) @@ -211,10 +211,10 @@ class Import(base.CommandBase): await self.set_progress_id(progress_id) -class Ticket(base.CommandBase): +class List(base.CommandBase): subcommands = (Get, Import) def __init__(self, host): - super(Ticket, self).__init__( - host, "ticket", use_profile=False, help=_("tickets handling") + super(List, self).__init__( + host, "list", use_profile=False, help=_("pubsub lists handling") )