Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
2602:41db2f58c753 | 2603:5d4ac5415b40 |
---|---|
154 - node metadata | 154 - node metadata |
155 - list of parsed request data (if extra['parse'] is set, else empty list) | 155 - list of parsed request data (if extra['parse'] is set, else empty list) |
156 """ | 156 """ |
157 if not node: | 157 if not node: |
158 node = NS_MERGE_REQUESTS | 158 node = NS_MERGE_REQUESTS |
159 if extra is None: | |
160 extra = {} | |
161 # XXX: Q&D way to get list for labels when displaying them, but text when we | |
162 # have to modify them | |
163 if C.bool(extra.get('labels_as_list', C.BOOL_FALSE)): | |
164 filters = {u'labels': self._s.textbox2ListFilter} | |
165 else: | |
166 filters = {} | |
159 tickets_xmlui, metadata = yield self._s.getDataFormItems( | 167 tickets_xmlui, metadata = yield self._s.getDataFormItems( |
160 client, | 168 client, |
161 service, | 169 service, |
162 node, | 170 node, |
163 max_items=max_items, | 171 max_items=max_items, |
164 item_ids=item_ids, | 172 item_ids=item_ids, |
165 sub_id=sub_id, | 173 sub_id=sub_id, |
166 rsm_request=rsm_request, | 174 rsm_request=rsm_request, |
167 extra=extra, | 175 extra=extra, |
168 form_ns=NS_MERGE_REQUESTS, | 176 form_ns=NS_MERGE_REQUESTS, |
169 filters = {u'labels': self._s.textbox2ListFilter}) | 177 filters = filters) |
170 parsed_patches = [] | 178 parsed_patches = [] |
171 if extra.get('parse', False): | 179 if extra.get('parse', False): |
172 for ticket in tickets_xmlui: | 180 for ticket in tickets_xmlui: |
173 request_type = ticket.named_widgets[FIELD_DATA_TYPE].value | 181 request_type = ticket.named_widgets[FIELD_DATA_TYPE].value |
174 request_data = ticket.named_widgets[FIELD_DATA].value | 182 request_data = ticket.named_widgets[FIELD_DATA].value |