コード例 #1
0
ファイル: transformer.py プロジェクト: rebeling/redmap
def organize_issues_by_type(data):
    restructure = {}
    for issue in data['issues']:
        # translate type Story, Task, Unterst...
        # and create a dict of all with a list of its issues
        type_of = red_t_(issue['tracker']['name'].encode('utf-8').lower())
        buffer = restructure.get(type_of, [])
        buffer.append(issue)
        restructure[type_of] = buffer
    return restructure
コード例 #2
0
ファイル: red_item.py プロジェクト: rebeling/redmap
def create_item(arg):

    # 'created_on',
    keys = ['id', 'type', 'subject', 'description', 'author', 'status',
            'position', 'fixed_version', 'assigned_to',
            'estimated_hours', 'parent']

    item = {}
    for k in keys:
        v = arg.get(k, None)
        if v:
            if type(v) is dict:
                if k == 'parent':
                    v = v.get('id', None)
                else:
                    v = v.get('name', None)
        try:
            if v and k in ['status']:
                v = str(red_t_(v.encode('utf-8').lower()))
            if v and k in ['id', 'parent']:
                v = str(v)
        except Exception, e:
            log.debug("e %s" % e)
        item[k] = v