Skip to content

Commit 2614337

Browse files
authored
Issue42489: Bug With experiment.save_batch (#43)
1 parent 8601e72 commit 2614337

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

CHANGE.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
LabKey Python Client API News
33
+++++++++++
44

5+
What's New in the LabKey 2.0.1 package
6+
==============================
7+
8+
*Release date: 02/01/2021*
9+
- Updated Run.to_json() to drop unset values, since keys are given default values server-side, and null values on the
10+
form result in exceptions
11+
512
What's New in the LabKey 2.0.0 package
613
==============================
714

labkey/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
from labkey import domain, query, experiment, security, utils
1717

1818
__title__ = "labkey"
19-
__version__ = "2.0.0"
19+
__version__ = "2.0.1"
2020
__author__ = "LabKey"
2121
__license__ = "Apache License 2.0"

labkey/experiment.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ def to_json(self):
103103
data["materialOutputs"] = self.material_outputs
104104
data["plateMetadata"] = self.plate_metadata
105105

106+
# Issue 2489: Drop empty values. Server supplies default values for missing keys,
107+
# and will throw exception if a null value is supplied
108+
data = {k: v for k, v in data.items() if v}
106109
return data
107110

108111

test/unit/test_experiment_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def setUp(self):
290290
self.service = MockSaveBatch()
291291
self.expected_kwargs = {
292292
"expected_args": [self.service.get_server_url()],
293-
"data": '{"assayId": 12345, "batches": [{"batchProtocolId": null, "comment": null, "created": null, "createdBy": null, "modified": null, "modifiedBy": null, "name": null, "properties": {"PropertyName": "Property Value"}, "runs": [{"comment": null, "created": null, "createdBy": null, "dataInputs": [], "dataRows": [], "experiments": [], "filePathRoot": null, "materialInputs": [], "materialOutputs": [], "modified": null, "modifiedBy": null, "name": "python upload", "plateMetadata": null, "properties": {"RunFieldName": "Run Field Value"}}]}]}',
293+
"data": '{"assayId": 12345, "batches": [{"batchProtocolId": null, "comment": null, "created": null, "createdBy": null, "modified": null, "modifiedBy": null, "name": null, "properties": {"PropertyName": "Property Value"}, "runs": [{"name": "python upload", "properties": {"RunFieldName": "Run Field Value"}}]}]}',
294294
"headers": {"Content-type": "application/json", "Accept": "text/plain"},
295295
"timeout": 300,
296296
}

0 commit comments

Comments
 (0)