示例#1
0
def get_task_type_raw(task_type_id):
    try:
        task_type = TaskType.get(task_type_id)
    except StatementError:
        raise TaskTypeNotFoundException()

    if task_type is None:
        raise TaskTypeNotFoundException()

    return task_type
示例#2
0
def get_task_type_raw(task_type_id):
    """
    Get task type matching given id as an active record.
    """
    try:
        task_type = TaskType.get(task_type_id)
    except StatementError:
        raise TaskTypeNotFoundException()

    if task_type is None:
        raise TaskTypeNotFoundException()

    return task_type
示例#3
0
def get_task_types_from_asset_type(data):
    """
    Return a list of task types objects from ids `task_types` list of data dict.

    Args:
        data (dict): Data from Resource POST
    """
    task_types = []
    if "task_types" in data:
        try:
            for task_type_id in data["task_types"]:
                task_type = TaskType.get(task_type_id)
                if task_type is not None:
                    task_types.append(task_type)
        except StatementError:
            raise TaskTypeNotFoundException()

    return task_types