Skip to content

Commit

Permalink
Fix logic error in do_my
Browse files Browse the repository at this point in the history
A dict doesn't work here (however, this codepath shouldn't be reached at
all).
  • Loading branch information
marcus-h committed Sep 13, 2016
1 parent e9cc000 commit 2816f32
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions osc/commandline.py
Expand Up @@ -6909,18 +6909,19 @@ def do_my(self, subcmd, opts, *args):
# if list of packages is empty user is maintainer of the whole project
request_todo = {}

dummy_elm = ET.Element('dummy')
roles = {}
if len(what.keys()) == 2:
for i in res.get('project_id', res.get('project', {})).findall('project'):
for i in res.get('project_id', res.get('project', dummy_elm)).findall('project'):
request_todo[i.get('name')] = []
roles[i.get('name')] = [p.get('role') for p in i.findall('person') if p.get('userid') == user]
for i in res.get('package_id', res.get('package', {})).findall('package'):
for i in res.get('package_id', res.get('package', dummy_elm)).findall('package'):
prj = i.get('project')
roles['/'.join([prj, i.get('name')])] = [p.get('role') for p in i.findall('person') if p.get('userid') == user]
if not prj in request_todo or request_todo[prj] != []:
request_todo.setdefault(prj, []).append(i.get('name'))
else:
for i in res.get('project_id', res.get('project', {})).findall('project'):
for i in res.get('project_id', res.get('project', dummy_elm)).findall('project'):
roles[i.get('name')] = [p.get('role') for p in i.findall('person') if p.get('userid') == user]

if list_requests:
Expand Down

0 comments on commit 2816f32

Please sign in to comment.