mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-10 13:05:46 +01:00
change some places where queries are passed to makeurl(). Use dictionaries for
that, which causes makeurl() to automatically do the quoting work.
This commit is contained in:
parent
6e5d41f481
commit
cc02e878b0
60
osc/core.py
60
osc/core.py
@ -670,7 +670,7 @@ class Package:
|
|||||||
|
|
||||||
# escaping '+' in the URL path (note: not in the URL query string) is
|
# escaping '+' in the URL path (note: not in the URL query string) is
|
||||||
# only a workaround for ruby on rails, which swallows it otherwise
|
# only a workaround for ruby on rails, which swallows it otherwise
|
||||||
query = ['rev=upload']
|
query = 'rev=upload'
|
||||||
u = makeurl(self.apiurl, ['source', self.prjname, self.name, pathname2url(n)], query=query)
|
u = makeurl(self.apiurl, ['source', self.prjname, self.name, pathname2url(n)], query=query)
|
||||||
http_PUT(u, file = os.path.join(self.dir, n))
|
http_PUT(u, file = os.path.join(self.dir, n))
|
||||||
|
|
||||||
@ -724,13 +724,12 @@ class Package:
|
|||||||
self.put_source_file(filename)
|
self.put_source_file(filename)
|
||||||
|
|
||||||
# all source files are committed - now comes the log
|
# all source files are committed - now comes the log
|
||||||
query = []
|
query = { 'cmd' : 'commit',
|
||||||
query.append('cmd=commit')
|
'rev' : 'upload',
|
||||||
query.append('rev=upload')
|
'user' : conf.get_apiurl_usr(self.apiurl),
|
||||||
|
'comment': msg }
|
||||||
if self.islink() and self.isexpanded():
|
if self.islink() and self.isexpanded():
|
||||||
query.append('keeplink=1')
|
query['keeplink'] = '1'
|
||||||
query.append('user=%s' % conf.get_apiurl_usr(self.apiurl))
|
|
||||||
query.append('comment=%s' % quote_plus(msg))
|
|
||||||
u = makeurl(self.apiurl, ['source', self.prjname, self.name], query=query)
|
u = makeurl(self.apiurl, ['source', self.prjname, self.name], query=query)
|
||||||
|
|
||||||
f = http_POST(u)
|
f = http_POST(u)
|
||||||
@ -1761,9 +1760,9 @@ def edit_meta(metatype,
|
|||||||
|
|
||||||
|
|
||||||
def show_files_meta(apiurl, prj, pac, revision=None):
|
def show_files_meta(apiurl, prj, pac, revision=None):
|
||||||
query = []
|
query = None
|
||||||
if revision:
|
if revision:
|
||||||
query.append('rev=%s' % revision)
|
query = { 'rev': revision }
|
||||||
f = http_GET(makeurl(apiurl, ['source', prj, pac], query=query))
|
f = http_GET(makeurl(apiurl, ['source', prj, pac], query=query))
|
||||||
return f.readlines()
|
return f.readlines()
|
||||||
|
|
||||||
@ -1876,7 +1875,7 @@ def create_submit_request(apiurl,
|
|||||||
r.dst_package,
|
r.dst_package,
|
||||||
r.descr)
|
r.descr)
|
||||||
|
|
||||||
u = makeurl(apiurl, ['request'], query=['cmd=create'])
|
u = makeurl(apiurl, ['request'], query='cmd=create')
|
||||||
f = http_POST(u, data=xml)
|
f = http_POST(u, data=xml)
|
||||||
|
|
||||||
root = ET.parse(f).getroot()
|
root = ET.parse(f).getroot()
|
||||||
@ -1896,7 +1895,7 @@ def get_submit_request(apiurl, reqid):
|
|||||||
def change_submit_request_state(apiurl, reqid, newstate, message=''):
|
def change_submit_request_state(apiurl, reqid, newstate, message=''):
|
||||||
u = makeurl(apiurl,
|
u = makeurl(apiurl,
|
||||||
['request', reqid],
|
['request', reqid],
|
||||||
query=['cmd=changestate', 'newstate=%s' % newstate])
|
query={'cmd': 'changestate', 'newstate': newstate})
|
||||||
f = http_POST(u, data=message)
|
f = http_POST(u, data=message)
|
||||||
return f.read()
|
return f.read()
|
||||||
|
|
||||||
@ -1953,9 +1952,9 @@ def get_user_data(apiurl, user, *tags):
|
|||||||
|
|
||||||
|
|
||||||
def get_source_file(apiurl, prj, package, filename, targetfilename=None, revision = None):
|
def get_source_file(apiurl, prj, package, filename, targetfilename=None, revision = None):
|
||||||
query = []
|
query = None
|
||||||
if revision:
|
if revision:
|
||||||
query.append('rev=%s' % quote_plus(revision))
|
query = { 'rev': revision }
|
||||||
|
|
||||||
u = makeurl(apiurl, ['source', prj, package, pathname2url(filename)], query=query)
|
u = makeurl(apiurl, ['source', prj, package, pathname2url(filename)], query=query)
|
||||||
# print 'url: %s' % u
|
# print 'url: %s' % u
|
||||||
@ -2469,9 +2468,9 @@ def get_binarylist_published(apiurl, prj, repo, arch):
|
|||||||
|
|
||||||
|
|
||||||
def show_results_meta(apiurl, prj, package=None):
|
def show_results_meta(apiurl, prj, package=None):
|
||||||
query = []
|
query = None
|
||||||
if package:
|
if package:
|
||||||
query.append('package=%s' % pathname2url(package))
|
query = { 'package': package }
|
||||||
u = makeurl(apiurl, ['build', prj, '_result'], query=query)
|
u = makeurl(apiurl, ['build', prj, '_result'], query=query)
|
||||||
f = http_GET(u)
|
f = http_GET(u)
|
||||||
return f.readlines()
|
return f.readlines()
|
||||||
@ -2696,16 +2695,15 @@ def get_commitlog(apiurl, prj, package, revision):
|
|||||||
|
|
||||||
|
|
||||||
def rebuild(apiurl, prj, package, repo, arch, code=None):
|
def rebuild(apiurl, prj, package, repo, arch, code=None):
|
||||||
query = []
|
query = { 'cmd': 'rebuild' }
|
||||||
query.append('cmd=rebuild')
|
|
||||||
if package:
|
if package:
|
||||||
query.append('package=%s' % quote_plus(package))
|
query['package'] = package
|
||||||
if repo:
|
if repo:
|
||||||
query.append('repository=%s' % quote_plus(repo))
|
query['repository'] = repo
|
||||||
if arch:
|
if arch:
|
||||||
query.append('arch=%s' % quote_plus(arch))
|
query['arch'] = arch
|
||||||
if code:
|
if code:
|
||||||
query.append('code=%s' % quote_plus(code))
|
query['code'] = code
|
||||||
|
|
||||||
u = makeurl(apiurl, ['build', prj], query=query)
|
u = makeurl(apiurl, ['build', prj], query=query)
|
||||||
try:
|
try:
|
||||||
@ -2767,14 +2765,13 @@ def get_osc_version():
|
|||||||
|
|
||||||
|
|
||||||
def abortbuild(apiurl, project, package=None, arch=None, repo=None):
|
def abortbuild(apiurl, project, package=None, arch=None, repo=None):
|
||||||
query = []
|
query = { 'cmd': 'abortbuild' }
|
||||||
query.append('cmd=abortbuild')
|
|
||||||
if package:
|
if package:
|
||||||
query.append('package=%s' % quote_plus(package))
|
query['package'] = package
|
||||||
if arch:
|
if arch:
|
||||||
query.append('arch=%s' % quote_plus(arch))
|
query['arch'] = arch
|
||||||
if repo:
|
if repo:
|
||||||
query.append('repository=%s' % quote_plus(repo))
|
query['repository'] = repo
|
||||||
u = makeurl(apiurl, ['build', project], query)
|
u = makeurl(apiurl, ['build', project], query)
|
||||||
try:
|
try:
|
||||||
f = http_POST(u)
|
f = http_POST(u)
|
||||||
@ -2795,16 +2792,15 @@ def abortbuild(apiurl, project, package=None, arch=None, repo=None):
|
|||||||
|
|
||||||
|
|
||||||
def wipebinaries(apiurl, project, package=None, arch=None, repo=None, code=None):
|
def wipebinaries(apiurl, project, package=None, arch=None, repo=None, code=None):
|
||||||
query = []
|
query = { 'cmd': 'wipe' }
|
||||||
query.append('cmd=wipe')
|
|
||||||
if package:
|
if package:
|
||||||
query.append('package=%s' % quote_plus(package))
|
query['package'] = package
|
||||||
if arch:
|
if arch:
|
||||||
query.append('arch=%s' % quote_plus(arch))
|
query['arch'] = arch
|
||||||
if repo:
|
if repo:
|
||||||
query.append('repository=%s' % quote_plus(repo))
|
query['repository'] = repo
|
||||||
if code:
|
if code:
|
||||||
query.append('code=%s' % quote_plus(code))
|
query['code'] = code
|
||||||
|
|
||||||
u = makeurl(apiurl, ['build', project], query)
|
u = makeurl(apiurl, ['build', project], query)
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user