mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-29 19:26:14 +01:00
don't query submit list request twice
This commit is contained in:
parent
7e76a8c269
commit
9452d717cb
30
osc/core.py
30
osc/core.py
@ -2153,16 +2153,9 @@ def change_request_state(apiurl, reqid, newstate, message=''):
|
|||||||
|
|
||||||
def get_request_list(apiurl, project, package, req_who='', req_state=('new',) ):
|
def get_request_list(apiurl, project, package, req_who='', req_state=('new',) ):
|
||||||
requests = []
|
requests = []
|
||||||
# XXX: we cannot use the '|' in the xpath expression because it is not supported
|
|
||||||
# in the backend
|
matches = []
|
||||||
for what in ['action', 'submit']:
|
match=''
|
||||||
match = ''
|
|
||||||
if project:
|
|
||||||
if len(match): match += '%20and%20'
|
|
||||||
match += '%s/target/@project=\'%s\'' % (what, quote_plus(project))
|
|
||||||
if package:
|
|
||||||
if len(match): match += '%20and%20'
|
|
||||||
match += '%s/target/@package=\'%s\'' % (what, quote_plus(package))
|
|
||||||
for state in req_state:
|
for state in req_state:
|
||||||
if len(match): match += '%20and%20'
|
if len(match): match += '%20and%20'
|
||||||
match += 'state/@name=\'%s\'' % quote_plus(state)
|
match += 'state/@name=\'%s\'' % quote_plus(state)
|
||||||
@ -2170,6 +2163,23 @@ def get_request_list(apiurl, project, package, req_who='', req_state=('new',) ):
|
|||||||
if len(match): match += '%20and%20'
|
if len(match): match += '%20and%20'
|
||||||
match += 'state/@who=\'%s\'' % quote_plus(req_who)
|
match += 'state/@who=\'%s\'' % quote_plus(req_who)
|
||||||
|
|
||||||
|
# XXX: we cannot use the '|' in the xpath expression because it is not supported
|
||||||
|
# in the backend
|
||||||
|
if project or package:
|
||||||
|
for what in ['action', 'submit']:
|
||||||
|
m = match
|
||||||
|
if project:
|
||||||
|
if len(m): m += '%20and%20'
|
||||||
|
m += '%s/target/@project=\'%s\'' % (what, quote_plus(project))
|
||||||
|
if package:
|
||||||
|
if len(m): m += '%20and%20'
|
||||||
|
m += '%s/target/@package=\'%s\'' % (what, quote_plus(package))
|
||||||
|
|
||||||
|
matches.append(m)
|
||||||
|
else:
|
||||||
|
matches.append(match)
|
||||||
|
|
||||||
|
for match in matches:
|
||||||
u = makeurl(apiurl, ['search', 'request'], ['match=%s' % match])
|
u = makeurl(apiurl, ['search', 'request'], ['match=%s' % match])
|
||||||
f = http_GET(u)
|
f = http_GET(u)
|
||||||
collection = ET.parse(f).getroot()
|
collection = ET.parse(f).getroot()
|
||||||
|
Loading…
Reference in New Issue
Block a user