Skip to content

Commit

Permalink
fix(dhis2): support null periods parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
yannforget committed May 27, 2024
1 parent cfc0ff4 commit e36e280
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions openhexa/toolbox/dhis2/dhis2.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,12 @@ def get(
if data_elements and not self.client.version >= "2.39":
raise DHIS2Error("Data elements parameter not supported for DHIS2 versions < 2.39")

if all([isinstance(pe, Period) for pe in periods]):
# convert Period objects to ISO strings
periods = [str(pe) for pe in periods]
elif not all([isinstance(pe, str) for pe in periods]):
raise ValueError("Mixed period types")
if periods:
if all([isinstance(pe, Period) for pe in periods]):
# convert Period objects to ISO strings
periods = [str(pe) for pe in periods]
elif not all([isinstance(pe, str) for pe in periods]):
raise ValueError("Mixed period types")

params = {
"dataElement": data_elements,
Expand Down

0 comments on commit e36e280

Please sign in to comment.