mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +01:00
- create_maintenance_request: use Request class to build the request
This commit is contained in:
parent
87b060e9a3
commit
65f817bfa8
28
osc/core.py
28
osc/core.py
@ -3469,28 +3469,14 @@ def clone_request(apiurl, reqid, msg=None):
|
||||
return project
|
||||
|
||||
# create a maintenance incident per request
|
||||
def create_maintenance_request(apiurl, src_project, dst_project, message="" ):
|
||||
def create_maintenance_request(apiurl, src_project, tgt_project, message=''):
|
||||
import cgi
|
||||
|
||||
xml = """\
|
||||
<request>
|
||||
<action type="maintenance_incident">
|
||||
<source project="%s" />
|
||||
<target project="%s" />
|
||||
</action>
|
||||
<state name="new"/>
|
||||
<description>%s</description>
|
||||
</request>
|
||||
""" % (src_project,
|
||||
dst_project,
|
||||
cgi.escape(unicode(message, "utf8")))
|
||||
|
||||
u = makeurl(apiurl, ['request'], query='cmd=create')
|
||||
f = http_POST(u, data=xml)
|
||||
|
||||
root = ET.parse(f).getroot()
|
||||
return root.get('id')
|
||||
|
||||
r = Request()
|
||||
r.add_action('maintenance_incident', src_project=src_project, src_package='foo', tgt_project=tgt_project)
|
||||
# XXX: clarify why we need the unicode(...) stuff
|
||||
r.description = cgi.escape(unicode(message, 'utf8'))
|
||||
r.create(apiurl)
|
||||
return r
|
||||
|
||||
# This creates an old style submit request for server api 1.0
|
||||
def create_submit_request(apiurl,
|
||||
|
Loading…
Reference in New Issue
Block a user