1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-13 01:06:15 +01:00

- fixed do_my (was broken by commit 54513a23de but nobody noticed it so far)

This commit is contained in:
Marcus Huewe 2010-09-29 19:57:00 +02:00
parent 64ac6aeb4f
commit b08802e9fe
2 changed files with 15 additions and 8 deletions

View File

@ -4838,20 +4838,21 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if opts.all: if opts.all:
role_filter = '' role_filter = ''
res = get_user_projpkgs(apiurl, user, role_filter, res = get_user_projpkgs(apiurl, user, role_filter, exclude_projects,
exclude_projects, what.has_key('project'), what.has_key('package'), opts.maintained) what.has_key('project'), what.has_key('package'),
opts.maintained, opts.verbose)
request_todo = {} request_todo = {}
roles = {} roles = {}
if len(what.keys()) == 2: 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')] = [] request_todo[i.get('name')] = []
roles[i.get('name')] = [p.get('role') for p in i.findall('person') if p.get('userid') == user] 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] 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(): if not i.get('project') in request_todo.keys():
request_todo.setdefault(i.get('project'), []).append(i.get('name')) request_todo.setdefault(i.get('project'), []).append(i.get('name'))
else: 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] roles[i.get('name')] = [p.get('role') for p in i.findall('person') if p.get('userid') == user]
if list_requests: if list_requests:

View File

@ -5560,7 +5560,7 @@ def request_interactive_review(apiurl, request):
if tmpfile is not None: if tmpfile is not None:
tmpfile.close() 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.""" """Return all project/packages where user is involved."""
xpath = 'person/@userid = \'%s\'' % user xpath = 'person/@userid = \'%s\'' % user
excl_prj = '' excl_prj = ''
@ -5579,9 +5579,15 @@ def get_user_projpkgs(apiurl, user, role=None, exclude_projects=[], proj=True, p
what = {} what = {}
if pkg: if pkg:
what['package_id'] = xpath_pkg if metadata:
what['package'] = xpath_pkg
else:
what['package_id'] = xpath_pkg
if proj: if proj:
what['project_id'] = xpath_prj if metadata:
what['project'] = xpath_prj
else:
what['project_id'] = xpath_prj
try: try:
res = search(apiurl, **what) res = search(apiurl, **what)
except urllib2.HTTPError, e: except urllib2.HTTPError, e: