From 9ca20870516d9a9f5792e6280085ea5d6c785ee9 Mon Sep 17 00:00:00 2001 From: yac Date: Wed, 28 Aug 2013 12:22:46 +0200 Subject: [PATCH] shortcircuit instead of if-else branching --- osc-group.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/osc-group.py b/osc-group.py index 8b1c13ac..686d1834 100644 --- a/osc-group.py +++ b/osc-group.py @@ -318,21 +318,22 @@ def _group_list_requests(self, grid, opts): :param opts: obs options """ - if not grid: - # search up the GR#s - url = makeurl(opts.apiurl, ['search', 'request', 'id?match=(action/@type=\'group\'%20and%20(state/@name=\'new\'%20or@20state/@name=\'review\'))'] ) - f = http_GET(url) - root = ET.parse(f).getroot() + # FIXME: find all requests in grouping request and print their content + # currently the we have to search for all grouping requests and then filter for proper id, highly suboptimal - res = _extract('id', int, 'request', root) - - print('Listing current open grouping requests...') - for rq in res: - self._print_group_header(rq, opts) - else: + if grid: self._print_group_header(grid, opts) - # FIXME: find all requests in grouping request and print their content - # currently the we have to search for all grouping requests and then filter for proper id, highly suboptimal + return + + # search up the GR#s + url = makeurl(opts.apiurl, ['search', 'request', 'id?match=(action/@type=\'group\'%20and%20(state/@name=\'new\'%20or@20state/@name=\'review\'))'] ) + f = http_GET(url) + root = ET.parse(f).getroot() + + print('Listing current open grouping requests...') + for rq in _extract('id', int, 'request', root): + self._print_group_header(rq, opts) + @cmdln.option('-v', '--version', action='store_true', dest='version',