コード例 #1
0
ファイル: views.py プロジェクト: skamille/orchestra
def create_project(request):
    project_details = json.loads(request.body.decode())
    try:
        if project_details['task_class'] == 'real':
            task_class = WorkerCertification.TaskClass.REAL
        else:
            task_class = WorkerCertification.TaskClass.TRAINING
        args = (
            project_details['workflow_slug'],
            project_details['workflow_version_slug'],
            project_details['description'],
            project_details['priority'],
            task_class,
            project_details['project_data'],
        )
    except KeyError:
        raise BadRequest('One of the parameters is missing')

    project = create_project_with_tasks(*args)
    return {'project_id': project.id}
コード例 #2
0
ファイル: views.py プロジェクト: puzanov/orchestra
def create_project(request):
    project_details = load_encoded_json(request.body)
    try:
        if project_details['task_class'] == 'real':
            task_class = WorkerCertification.TaskClass.REAL
        else:
            task_class = WorkerCertification.TaskClass.TRAINING
        args = (
            project_details['workflow_slug'],
            project_details['workflow_version_slug'],
            project_details['description'],
            project_details['priority'],
            task_class,
            project_details['project_data'],
        )
    except KeyError:
        raise BadRequest('One of the parameters is missing')

    project = create_project_with_tasks(*args)
    return {'project_id': project.id}
コード例 #3
0
ファイル: views.py プロジェクト: dretelny/orchestra
def create_project(request):
    project_details = json.loads(request.body.decode())
    try:
        if project_details["task_class"] == "real":
            task_class = WorkerCertification.TaskClass.REAL
        else:
            task_class = WorkerCertification.TaskClass.TRAINING
        args = (
            project_details["workflow_slug"],
            project_details["description"],
            project_details["priority"],
            task_class,
            project_details["project_data"],
            project_details["review_document_url"],
        )
        version_slug = project_details.get("workflow_version_slug", None)
    except KeyError:
        raise BadRequest("One of the parameters is missing")

    project = create_project_with_tasks(*args, workflow_version_slug=version_slug)
    return {"project_id": project.id}