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}
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}
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}