diff sat/plugins/plugin_misc_merge_requests.py @ 2603:5d4ac5415b40

plugins schema, merge-requests, tickets: convert labels from textbox to list only when "labels_as_list" is set in extra parameters.
author Goffi <goffi@goffi.org>
date Fri, 01 Jun 2018 12:21:23 +0200
parents 26edcf3a30eb
children 700327fa9281
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_merge_requests.py	Fri Jun 01 12:17:06 2018 +0200
+++ b/sat/plugins/plugin_misc_merge_requests.py	Fri Jun 01 12:21:23 2018 +0200
@@ -156,6 +156,14 @@
         """
         if not node:
             node = NS_MERGE_REQUESTS
+        if extra is None:
+            extra = {}
+        # XXX: Q&D way to get list for labels when displaying them, but text when we
+        #      have to modify them
+        if C.bool(extra.get('labels_as_list', C.BOOL_FALSE)):
+            filters = {u'labels': self._s.textbox2ListFilter}
+        else:
+            filters = {}
         tickets_xmlui, metadata = yield self._s.getDataFormItems(
             client,
             service,
@@ -166,7 +174,7 @@
             rsm_request=rsm_request,
             extra=extra,
             form_ns=NS_MERGE_REQUESTS,
-            filters = {u'labels': self._s.textbox2ListFilter})
+            filters = filters)
         parsed_patches = []
         if extra.get('parse', False):
             for ticket in tickets_xmlui: