Mercurial > libervia-backend
diff src/plugins/plugin_tickets_import_bugzilla.py @ 2390:f57a8eaec8ed
plugins import, tickets import, bugzilla import: comments handling:
- comments are put in "comments" key in import data, it's a list of microblog data
- in resulting item, the comments uri is put in comments_uri field
- (plugin import) root_service and root_node are kept in session
- (plugin ticket) reporter name is now in "reporter" key instead of "reporter_name"
- (plugin bugizlla): if not reporter name is found, first part of email address is used
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 20 Oct 2017 08:48:41 +0200 |
parents | a49a19f06e38 |
children | acfc481629ac |
line wrap: on
line diff
--- a/src/plugins/plugin_tickets_import_bugzilla.py Fri Oct 20 08:44:09 2017 +0200 +++ b/src/plugins/plugin_tickets_import_bugzilla.py Fri Oct 20 08:48:41 2017 +0200 @@ -26,6 +26,7 @@ from twisted.internet import defer import os.path from lxml import etree +from sat.tools import utils PLUGIN_INFO = { @@ -71,7 +72,12 @@ ticket['update'] = bug.findtext('delta_ts') ticket['title'] = bug.findtext('short_desc') reporter_elt = bug.find('reporter') - ticket['reporter_name'] = reporter_elt.get('name') + ticket['reporter'] = reporter_elt.get('name') + if ticket['reporter'] is None: + if '@' in reporter_elt.text: + ticket['reporter'] = reporter_elt.text[:reporter_elt.text.find('@')].title() + else: + ticket['reporter'] = u'no name' ticket['reporter_email'] = reporter_elt.text assigned_to_elt = bug.find('assigned_to') ticket['assigned_to_name'] = assigned_to_elt.get('name') @@ -95,10 +101,11 @@ body = longdesc.findtext('thetext') else: who = longdesc.find('who') - comment = {'from': who.text, - 'date': longdesc.findtext('bug_when'), - 'nick': who.get('name'), - 'body': longdesc.findtext('thetext')} + comment = {'id': longdesc.findtext('commentid'), + 'author_email': who.text, + 'published': utils.date_parse(longdesc.findtext('bug_when')), + 'author': who.get('name', who.text), + 'content': longdesc.findtext('thetext')} comments.append(comment) ticket['body'] = body