def import_work_items(self, issue_id, work_items):
xml = ''
for work_item in work_items:
xml += '<workItem>'
xml += '<date>%s</date>' % work_item.date
xml += '<duration>%s</duration>' % work_item.duration
if hasattr(work_item, 'description') and work_item.description is not None:
xml += '<description>%s</description>' % escape(work_item.description)
if hasattr(work_item, 'worktype') and work_item.worktype is not None:
xml += '<worktype><name>%s</name></worktype>' % work_item.worktype
xml += '<author login=%s></author>' % quoteattr(work_item.authorLogin)
xml += '</workItem>'
if isinstance(xml, str):
xml = xml.encode('utf-8')
if xml:
xml = '<workItems>' + xml + '</workItems>'
self._req_xml('PUT',
'/import/issue/%s/workitems' % urlquote(issue_id), xml)
评论列表
文章目录