shortcircuit instead of if-else branching
This commit is contained in:
parent
8269de3ce8
commit
9ca2087051
17
osc-group.py
17
osc-group.py
@ -318,21 +318,22 @@ def _group_list_requests(self, grid, opts):
|
|||||||
:param opts: obs options
|
:param opts: obs options
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not grid:
|
# 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
|
||||||
|
|
||||||
|
if grid:
|
||||||
|
self._print_group_header(grid, opts)
|
||||||
|
return
|
||||||
|
|
||||||
# search up the GR#s
|
# 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\'))'] )
|
url = makeurl(opts.apiurl, ['search', 'request', 'id?match=(action/@type=\'group\'%20and%20(state/@name=\'new\'%20or@20state/@name=\'review\'))'] )
|
||||||
f = http_GET(url)
|
f = http_GET(url)
|
||||||
root = ET.parse(f).getroot()
|
root = ET.parse(f).getroot()
|
||||||
|
|
||||||
res = _extract('id', int, 'request', root)
|
|
||||||
|
|
||||||
print('Listing current open grouping requests...')
|
print('Listing current open grouping requests...')
|
||||||
for rq in res:
|
for rq in _extract('id', int, 'request', root):
|
||||||
self._print_group_header(rq, opts)
|
self._print_group_header(rq, opts)
|
||||||
else:
|
|
||||||
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
|
|
||||||
|
|
||||||
@cmdln.option('-v', '--version', action='store_true',
|
@cmdln.option('-v', '--version', action='store_true',
|
||||||
dest='version',
|
dest='version',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user