Example #1
0
def process_relationships(stream):
    """Produce a csv list of all relationships between source components and
    target components, and their kind of relationship."""
    logger.info('process_relationships started')
    db = Factory.get('Database')()
    role = Role(db)
    for row in role.search_relations():
        stream.write(';'.join(
            (row['source_name'], str(row['relationship_str']),
             row['target_name'])))
        stream.write('\n')
    logger.info('process_relationships done')
def process_relationships(stream):
    """Produce a csv list of all relationships between source components and
    target components, and their kind of relationship."""
    logger.info('process_relationships started')
    db = Factory.get('Database')()
    role = Role(db)
    for row in role.search_relations():
        stream.write(';'.join((row['source_name'],
                               text_type(row['relationship_str']),
                               row['target_name'])))
        stream.write('\n')
    logger.info('process_relationships done')
Example #3
0
def process_roles(stream):
    """Produce a csv list of all roles and its direct members."""
    logger.info('process_roles started')
    db = Factory.get('Database')()
    role = Role(db)
    # TODO: might want to use search_relations directly, and map it in python
    # instead of have a relations call for every role (there might be a lot of
    # roles in the future?).
    for row in role.search():
        stream.write(';'.join(
            (row['name'], row['description'], row['foundation']
             or '', row['created_at'].strftime('%Y-%m-%d'),
             ','.join(m['target_name'] for m in role.search_relations(
                 source_id=row['component_id'])))))
        stream.write('\n')
    logger.info('process_roles done')
def process_roles(stream):
    """Produce a csv list of all roles and its direct members."""
    logger.info('process_roles started')
    db = Factory.get('Database')()
    role = Role(db)
    # TODO: might want to use search_relations directly, and map it in python
    # instead of have a relations call for every role (there might be a lot of
    # roles in the future?).
    for row in role.search():
        stream.write(';'.join((row['name'],
                               row['description'],
                               row['foundation'] or '',
                               row['created_at'].strftime('%Y-%m-%d'),
                               ','.join(m['target_name'] for m in
                                        role.search_relations(
                                            source_id=row['component_id'])))))
        stream.write('\n')
    logger.info('process_roles done')