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
This commit is contained in:
parent
363ee1db88
commit
08a14fa4ac
4 changed files with 50 additions and 19 deletions
|
|
@ -26,6 +26,7 @@ from sat.core import exceptions
|
|||
from twisted.internet import defer
|
||||
import os.path
|
||||
from lxml import etree
|
||||
from sat.tools import utils
|
||||
|
||||
|
||||
PLUGIN_INFO = {
|
||||
|
|
@ -71,7 +72,12 @@ class BugzillaParser(object):
|
|||
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 @@ class BugzillaParser(object):
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue