Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
]


log = logging.getLogger(__name__)
_logger = logging.getLogger(__name__)

CopyFileCoro: TypeAlias = Coroutine[Any, Any, None]
CopyProjectNodesCoro: TypeAlias = Coroutine[Any, Any, dict[NodeID, ProjectNodeCreate]]
Expand Down Expand Up @@ -285,6 +285,13 @@ async def create_project( # pylint: disable=too-many-arguments,too-many-branche

"""
assert request.app # nosec
_logger.info(
"create_project for '%s' with %s %s %s",
f"{user_id=}",
f"{predefined_project=}",
f"{product_name=}",
f"{from_study=}",
)

_projects_repository = ProjectDBAPI.get_from_app_context(request.app)

Expand Down Expand Up @@ -459,6 +466,17 @@ async def create_project( # pylint: disable=too-many-arguments,too-many-branche
for gid, access in workspace.access_rights.items()
}

_project_product_name = await _projects_repository.get_project_product(
project_uuid=new_project["uuid"]
)
assert (
_project_product_name == product_name # nosec
), "Project product name mismatch"
if _project_product_name != product_name:
raise web.HTTPBadRequest(
text=f"Project product name mismatch {product_name=} {_project_product_name=}"
)

data = ProjectGet.from_domain_model(new_project).model_dump(
**RESPONSE_MODEL_POLICY
)
Expand Down Expand Up @@ -488,7 +506,7 @@ async def create_project( # pylint: disable=too-many-arguments,too-many-branche
raise web.HTTPNotFound(text=f"{exc}") from exc

except asyncio.CancelledError:
log.warning(
_logger.warning(
"cancelled create_project for '%s'. Cleaning up",
f"{user_id=}",
)
Expand Down
Loading