Skip to content

Commit f34603e

Browse files
dicomtrolley/mint.py - changed pydantic validation method MintQuery::min_max_study_date_xor to an instance method #62
1 parent 3679a53 commit f34603e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dicomtrolley/mint.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ class MintQuery(ExtendedQuery):
160160
limit: int = 0 # how many results to return. 0 = all
161161

162162
@model_validator(mode="after")
163-
def min_max_study_date_xor(cls, values): # noqa: B902, N805
163+
def min_max_study_date_xor(self): # noqa: B902, N805
164164
"""Min and max should both be given or both be empty"""
165-
min_date = values.min_study_date
166-
max_date = values.max_study_date
165+
min_date = self.min_study_date
166+
max_date = self.max_study_date
167167
if min_date and not max_date:
168168
raise ValueError(
169169
f"min_study_date parameter was passed"
@@ -175,7 +175,7 @@ def min_max_study_date_xor(cls, values): # noqa: B902, N805
175175
f"max_study_date parameter was passed ({max_date}), "
176176
f"but min_study_date was not. Both need to be given"
177177
)
178-
return values
178+
return self
179179

180180
@model_validator(mode="after")
181181
def include_fields_check(self):

0 commit comments

Comments
 (0)