示例#1
0
def _toticket(d):
    cfg = config.parseconfig()
    j = dict(number = d['local_id'],
             state = d['status'],
             title = d['title'],
             body = d['content'],
             labels = nested_access(d, 'metadata.kind'),
             priority = d['priority'],
             milestone = nested_access(d, 'metadata.milestone'),
             creator = nested_access(d, 'reported_by.username'),
             creator_fullname = u' '.join((nested_access(d, 'reported_by.first_name'), nested_access(d, 'reported_by.last_name'))),
             html_url = ISSUEURL.format(issueid=d['local_id'], **cfg),
             assignee = nested_access(d, 'responsible.username'),
             comments = d['comment_count'],
             created = _todatetime(d['utc_created_on']),
             updated = _todatetime(d['utc_last_updated']))
    if 'responsible' in d:
        j['assignee_fullname'] = u' '.join((nested_access(d, 'responsible.first_name'), nested_access(d, 'responsible.last_name')))
    return ticket.Ticket(**j)
示例#2
0
def _toticket(d):
    cfg = config.parseconfig()
    j = dict(number = d['id'],
             state = nested_access(d, 'status.name'),
             priority = nested_access(d, 'priority.name'),
             labels = nested_access(d, 'tracker.name'),
             html_url = ISSUE_URL.format(issueid=d['id'], **cfg),
             title = d['subject'],
             body = d.get('description', None),
             creator = user(nested_access(d, 'author.id'))['login'],
             creator_fullname = nested_access(d, 'author.name'),
             assignee_fullname = nested_access(d, 'assigned_to.name'),
             created = _todatetime(d['created_on']),
             updated = _todatetime(d['updated_on']))
    if 'assigned_to' in d:
        j['assignee'] = user(nested_access(d, 'assigned_to.id'))['login']
    tic = ticket.Ticket(**j)
    setattr(tic, 'priority_id', nested_access(d, 'priority.id'))  # Redmineにpriorityを取得するAPIがないためあとで参照しなければならない
    return tic
示例#3
0
def _toticket(d):
    j = dict(number=d['number'],
             state=d['state'],
             title=d['title'],
             body=d['body'],
             creator=nested_access(d, 'user.login'),
             assignee=nested_access(d, 'assignee.login'),
             labels=[x['name'] for x in d['labels']],
             comments=d['comments'],
             milestone=nested_access(d, 'milestone.title'),
             created=todatetime(d['created_at']),
             updated=todatetime(d['updated_at']),
             closed=todatetime(d['closed_at']),
             html_url=d['html_url'])
    if nested_access(d, 'pull_request.html_url'):
        j['pull_request'] = 'Pull Request'
    t = ticket.Ticket(**j)
    if nested_access(d, 'milestone.id'):
        t.milestone_id = nested_access(d, 'milestone.id')
    return t