From b08802e9fe5082adffecca15afbf3d61c87eea98 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Wed, 29 Sep 2010 19:57:00 +0200 Subject: [PATCH] - fixed do_my (was broken by commit 54513a23defe7d9052c2ef31ce38fcd70b1488bc but nobody noticed it so far) --- osc/commandline.py | 11 ++++++----- osc/core.py | 12 +++++++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index 61fa3e94..22b33b68 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -4838,20 +4838,21 @@ Please submit there instead, or use --nodevelproject to force direct submission. if opts.all: role_filter = '' - res = get_user_projpkgs(apiurl, user, role_filter, - exclude_projects, what.has_key('project'), what.has_key('package'), opts.maintained) + res = get_user_projpkgs(apiurl, user, role_filter, exclude_projects, + what.has_key('project'), what.has_key('package'), + opts.maintained, opts.verbose) request_todo = {} roles = {} if len(what.keys()) == 2: - for i in res['project_id'].findall('project'): + for i in res.get('project_id', res.get('project', {})).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['package_id'].findall('package'): + for i in res.get('package_id', res.get('package', {})).findall('package'): roles['/'.join([i.get('project'), i.get('name')])] = [p.get('role') for p in i.findall('person') if p.get('userid') == user] if not i.get('project') in request_todo.keys(): request_todo.setdefault(i.get('project'), []).append(i.get('name')) else: - for i in res['project_id'].findall('project'): + for i in res.get('project_id', res.get('project', {})).findall('project'): roles[i.get('name')] = [p.get('role') for p in i.findall('person') if p.get('userid') == user] if list_requests: diff --git a/osc/core.py b/osc/core.py index 5a80a945..da4d453d 100644 --- a/osc/core.py +++ b/osc/core.py @@ -5560,7 +5560,7 @@ def request_interactive_review(apiurl, request): if tmpfile is not None: tmpfile.close() -def get_user_projpkgs(apiurl, user, role=None, exclude_projects=[], proj=True, pkg=True, maintained=False): +def get_user_projpkgs(apiurl, user, role=None, exclude_projects=[], proj=True, pkg=True, maintained=False, metadata=False): """Return all project/packages where user is involved.""" xpath = 'person/@userid = \'%s\'' % user excl_prj = '' @@ -5579,9 +5579,15 @@ def get_user_projpkgs(apiurl, user, role=None, exclude_projects=[], proj=True, p what = {} if pkg: - what['package_id'] = xpath_pkg + if metadata: + what['package'] = xpath_pkg + else: + what['package_id'] = xpath_pkg if proj: - what['project_id'] = xpath_prj + if metadata: + what['project'] = xpath_prj + else: + what['project_id'] = xpath_prj try: res = search(apiurl, **what) except urllib2.HTTPError, e: