Пример #1
0
def fields_to_person_object(fields):
    result = Person(fields['id'])

    for f in fields.keys():
        if f == 'name':
            result.name = fields[f]
        elif f == 'title':
            result.title = fields[f]
        elif f == 'team':
            result.team = fields[f]
        elif f == 'picture':
            result.picture = fields[f]
    return result
Пример #2
0
def work_data_to_work_object(work_data):
    result = []
    for w in work_data:
        work = fields_to_work_object(w)
        work.start_date = dovetail.util.condition_date(w['start_date'])
        work.end_date = dovetail.util.condition_date(w['end_date'])

        assignee = Person(w['person_id'])
        assignee.name = w['assignee_name']
        assignee.picture = w['assignee_picture']

        # TODO: The controller should do this
        assignee.detail_url = '/people/%d' % w['person_id']
        work.assignee = assignee
        result.append(work)
    return result
Пример #3
0
def work_data_to_work_object(work_data):
    result = []
    for w in work_data:
        work = fields_to_work_object(w)
        work.start_date = dovetail.util.condition_date(w['start_date'])
        work.end_date = dovetail.util.condition_date(w['end_date'])

        assignee = Person(w['person_id'])
        assignee.name = w['assignee_name']
        assignee.picture = w['assignee_picture']

        # TODO: The controller should do this
        assignee.detail_url = '/people/%d' % w['person_id']
        work.assignee = assignee
        result.append(work)
    return result