mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
Cleanup url construction in core.show_results_meta
The old code was flawed, because, for instance, core.show_results_meta(apiurl, project, arch=['x86_64']) resulted in a wrong http request: GET <apiurl>/build/<project>/_result&arch=x86_64 (note the "&" instead of the correct "?"). The drawback of the new implementation is that we have to do the proper quoting manually.
This commit is contained in:
parent
2d327df4e7
commit
8a81a68028
18
osc/core.py
18
osc/core.py
@ -5527,22 +5527,22 @@ def get_binarylist_published(apiurl, prj, repo, arch):
|
||||
|
||||
|
||||
def show_results_meta(apiurl, prj, package=None, lastbuild=None, repository=[], arch=[], oldstate=None, multibuild=False, locallink=False):
|
||||
query = {}
|
||||
query = []
|
||||
if package:
|
||||
query['package'] = package
|
||||
query.append('package=%s' % quote_plus(package))
|
||||
if oldstate:
|
||||
query['oldstate'] = oldstate
|
||||
query.append('oldstate=%s' % quote_plus(oldstate))
|
||||
if lastbuild:
|
||||
query['lastbuild'] = 1
|
||||
query.append('lastbuild=1')
|
||||
if multibuild:
|
||||
query['multibuild'] = 1
|
||||
query.append('multibuild=1')
|
||||
if locallink:
|
||||
query['locallink'] = 1
|
||||
u = makeurl(apiurl, ['build', prj, '_result'], query=query)
|
||||
query.append('locallink=1')
|
||||
for repo in repository:
|
||||
u = u + '&repository=%s' % repo
|
||||
query.append('repository=%s' % quote_plus(repo))
|
||||
for a in arch:
|
||||
u = u + '&arch=%s' % a
|
||||
query.append('arch=%s' % quote_plus(a))
|
||||
u = makeurl(apiurl, ['build', prj, '_result'], query=query)
|
||||
f = http_GET(u)
|
||||
return f.readlines()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user