mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 18:06:13 +01:00
Dedent main code for get_distributions
This commit is contained in:
parent
4d6a6aaf96
commit
3ae3c88a95
25
osc/core.py
25
osc/core.py
@ -5625,20 +5625,19 @@ def get_distributions(apiurl, discon=False):
|
|||||||
r.insert(1, '------------ -------')
|
r.insert(1, '------------ -------')
|
||||||
return r
|
return r
|
||||||
|
|
||||||
else:
|
f = http_GET(makeurl(apiurl, ['distributions']))
|
||||||
f = http_GET(makeurl(apiurl, ['distributions']))
|
root = ET.fromstring(b''.join(f))
|
||||||
root = ET.fromstring(b''.join(f))
|
|
||||||
|
|
||||||
distlist = []
|
distlist = []
|
||||||
for node in root.findall('distribution'):
|
for node in root.findall('distribution'):
|
||||||
dmap = {}
|
dmap = {}
|
||||||
for child in node:
|
for child in node:
|
||||||
if child.tag == 'name':
|
if child.tag == 'name':
|
||||||
dmap['distribution'] = child.text
|
dmap['distribution'] = child.text
|
||||||
elif child.tag in ('project', 'repository', 'reponame'):
|
elif child.tag in ('project', 'repository', 'reponame'):
|
||||||
dmap[child.tag] = child.text
|
dmap[child.tag] = child.text
|
||||||
distlist.append(dmap)
|
distlist.append(dmap)
|
||||||
return distlist
|
return distlist
|
||||||
|
|
||||||
|
|
||||||
# old compat lib call
|
# old compat lib call
|
||||||
|
Loading…
Reference in New Issue
Block a user