mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-11 16:36:14 +01:00
- reworked do_requestmaintainership()
This commit is contained in:
parent
db8818c30f
commit
8a488d3b6d
@ -1459,11 +1459,19 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
|
import cgi
|
||||||
args = slash_split(args)
|
args = slash_split(args)
|
||||||
apiurl = self.get_api_url()
|
apiurl = self.get_api_url()
|
||||||
|
|
||||||
if len(args) < 2:
|
if len(args) == 2:
|
||||||
if is_package_dir(os.getcwd()):
|
project = args[0]
|
||||||
|
package = args[1]
|
||||||
|
user = conf.get_apiurl_usr(apiurl)
|
||||||
|
elif len(args) == 3:
|
||||||
|
project = args[0]
|
||||||
|
package = args[1]
|
||||||
|
user = args[2]
|
||||||
|
elif len(args) < 2 and is_package_dir(os.curdir):
|
||||||
project = store_read_project(os.curdir)
|
project = store_read_project(os.curdir)
|
||||||
package = store_read_package(os.curdir)
|
package = store_read_package(os.curdir)
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
@ -1472,35 +1480,18 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
user = args[0]
|
user = args[0]
|
||||||
else:
|
else:
|
||||||
raise oscerr.WrongArgs('Wrong number of arguments.')
|
raise oscerr.WrongArgs('Wrong number of arguments.')
|
||||||
elif len(args) == 2:
|
|
||||||
project = args[0]
|
|
||||||
package = args[1]
|
|
||||||
user = conf.get_apiurl_usr(apiurl)
|
|
||||||
elif len(args) == 3:
|
|
||||||
project = args[0]
|
|
||||||
package = args[1]
|
|
||||||
user = args[2]
|
|
||||||
else:
|
|
||||||
raise oscerr.WrongArgs('Wrong number of arguments.')
|
|
||||||
|
|
||||||
if not opts.role in ('maintainer', 'bugowner'):
|
if not opts.role in ('maintainer', 'bugowner'):
|
||||||
raise oscerr.WrongOptions('invalid \'--role\': either specify \'maintainer\' or \'bugowner\'')
|
raise oscerr.WrongOptions('invalid \'--role\': either specify \'maintainer\' or \'bugowner\'')
|
||||||
|
|
||||||
arg = [ user, opts.role, project, package ]
|
|
||||||
|
|
||||||
actionsxml = self._add_user(arg, None)
|
|
||||||
|
|
||||||
if not opts.message:
|
if not opts.message:
|
||||||
opts.message = edit_message()
|
opts.message = edit_message()
|
||||||
|
|
||||||
import cgi
|
r = Request()
|
||||||
xml = """<request> %s <state name="new"/> <description>%s</description> </request> """ % \
|
r.add_action('add_role', tgt_project=project, tgt_package=package,
|
||||||
(actionsxml, cgi.escape(opts.message or ""))
|
person_name=user, person_role=opts.role)
|
||||||
u = makeurl(apiurl, ['request'], query='cmd=create')
|
r.description = cgi.escape(opts.message or '')
|
||||||
f = http_POST(u, data=xml)
|
r.create(apiurl)
|
||||||
|
print r.reqid
|
||||||
root = ET.parse(f).getroot()
|
|
||||||
return root.get('id')
|
|
||||||
|
|
||||||
@cmdln.option('-m', '--message', metavar='TEXT',
|
@cmdln.option('-m', '--message', metavar='TEXT',
|
||||||
help='specify message TEXT')
|
help='specify message TEXT')
|
||||||
|
Loading…
Reference in New Issue
Block a user