Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-45799: protect campaign creation against missing arguments #90

Merged
merged 1 commit into from
Sep 6, 2024
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
8 changes: 8 additions & 0 deletions src/lsst/cmservice/db/campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,17 @@ async def get_create_kwargs(
)

data = kwargs.get("data", {})
if data is None:
data = {}
child_config = kwargs.get("child_config", {})
if child_config is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does kwargs.get return None here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the pydantic model set it to None.

child_config = {}
collections = kwargs.get("collections", {})
if collections is None:
collections = {}
spec_aliases = kwargs.get("spec_aliases", {})
if spec_aliases is None:
spec_aliases = {}

await session.refresh(
specification,
Expand Down
Loading