1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-14 09:36:21 +01:00

added missing delPerson function

do_maintainer relly on delPerson, which did not exists. It is
taken from old delMaintainer function with role handling.
Fixed also some issues in do_maintainer role handling
This commit is contained in:
Michal Vyskocil 2009-08-26 14:22:54 +00:00
parent 5eb2364c3d
commit 816a982acf
2 changed files with 15 additions and 7 deletions

View File

@ -3251,7 +3251,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if not url.startswith('http'):
if not url.startswith('/'):
url = '/' + url
url = conf.config['apiurl'] + url
url = conf.config['apiurl']
if opts.headers:
opts.headers = dict(opts.headers)
@ -3299,8 +3299,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
maintainers = []
pac = None
tree = None
role = opts.role
roles = [ 'bugowner', 'maintainer' ]
if not opts.role:
roles = [ 'bugowner', 'maintainer' ]
else:
roles = [opts.role]
if opts.bugowner:
roles = [ 'bugowner' ]
@ -3329,9 +3331,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
raise oscerr.WrongArgs('I need at least one argument.')
if opts.add:
addPerson(conf.config['apiurl'], prj, pac, opts.add, role)
for role in roles:
addPerson(conf.config['apiurl'], prj, pac, opts.add, role)
elif opts.delete:
delPerson(conf.config['apiurl'], prj, pac, opts.delete, role)
for role in roles:
delPerson(conf.config['apiurl'], prj, pac, opts.delete, role)
elif opts.devel_project:
setDevelProject(conf.config['apiurl'], prj, pac, opts.devel_project)
else:

View File

@ -3920,7 +3920,11 @@ def addPerson(apiurl, prj, pac, user, role="maintainer"):
print "osc: an error occured"
def delMaintainer(apiurl, prj, pac, user):
""" delete a maintainer from a package or project """
# for backward compatibility only
delPerson(apiurl, prj, pac, user)
def delPerson(apiurl, prj, pac, user, role="maintainer"):
""" delete a person from a package or project """
path = quote_plus(prj),
kind = 'prj'
if pac:
@ -3934,7 +3938,7 @@ def delMaintainer(apiurl, prj, pac, user):
tree = ET.fromstring(''.join(data))
found = False
for person in tree.getiterator('person'):
if person.get('userid') == user:
if person.get('userid') == user and person.get('role') == role:
tree.remove(person)
found = True
print "user \'%s\' removed" % user