Skip to content

Commit

Permalink
only check if data component is serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Aug 17, 2022
1 parent 96e9772 commit 9999390
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions mpcontribs-client/mpcontribs/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1350,9 +1350,10 @@ def update_contributions(
if not valid:
return {"error": error}

serializable, error = self._is_serializable_dict(data)
if not serializable:
return {"error": error}
if "data" in data:
serializable, error = self._is_serializable_dict(data["data"])
if not serializable:
return {"error": error}

query = query or {}

Expand Down Expand Up @@ -1580,9 +1581,10 @@ def submit_contributions(
fields.remove("needs_build") # internal field

for contrib in tqdm(contributions, desc="Prepare"):
serializable, error = self._is_serializable_dict(contrib)
if not serializable:
raise ValueError(error)
if "data" in contrib:
serializable, error = self._is_serializable_dict(contrib["data"])
if not serializable:
raise ValueError(error)

update = "id" in contrib
project_name = id2project[contrib["id"]] if update else contrib["project"]
Expand Down

0 comments on commit 9999390

Please sign in to comment.