mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-29 03:06:15 +01:00
don't query submit list request twice
This commit is contained in:
parent
7e76a8c269
commit
9452d717cb
38
osc/core.py
38
osc/core.py
@ -2153,23 +2153,33 @@ 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 = []
|
||||||
|
|
||||||
|
matches = []
|
||||||
|
match=''
|
||||||
|
for state in req_state:
|
||||||
|
if len(match): match += '%20and%20'
|
||||||
|
match += 'state/@name=\'%s\'' % quote_plus(state)
|
||||||
|
if req_who:
|
||||||
|
if len(match): match += '%20and%20'
|
||||||
|
match += 'state/@who=\'%s\'' % quote_plus(req_who)
|
||||||
|
|
||||||
# XXX: we cannot use the '|' in the xpath expression because it is not supported
|
# XXX: we cannot use the '|' in the xpath expression because it is not supported
|
||||||
# in the backend
|
# in the backend
|
||||||
for what in ['action', 'submit']:
|
if project or package:
|
||||||
match = ''
|
for what in ['action', 'submit']:
|
||||||
if project:
|
m = match
|
||||||
if len(match): match += '%20and%20'
|
if project:
|
||||||
match += '%s/target/@project=\'%s\'' % (what, quote_plus(project))
|
if len(m): m += '%20and%20'
|
||||||
if package:
|
m += '%s/target/@project=\'%s\'' % (what, quote_plus(project))
|
||||||
if len(match): match += '%20and%20'
|
if package:
|
||||||
match += '%s/target/@package=\'%s\'' % (what, quote_plus(package))
|
if len(m): m += '%20and%20'
|
||||||
for state in req_state:
|
m += '%s/target/@package=\'%s\'' % (what, quote_plus(package))
|
||||||
if len(match): match += '%20and%20'
|
|
||||||
match += 'state/@name=\'%s\'' % quote_plus(state)
|
|
||||||
if req_who:
|
|
||||||
if len(match): match += '%20and%20'
|
|
||||||
match += 'state/@who=\'%s\'' % quote_plus(req_who)
|
|
||||||
|
|
||||||
|
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