Fix backward compatibility when using datetime filtering for GetAllRequest in models.py and tasks.py

This commit is contained in:
Alex Burlacu 2023-03-29 19:01:03 +03:00
parent 6f1c208726
commit fc8435e26b
2 changed files with 12 additions and 8 deletions

View File

@ -2242,11 +2242,11 @@ class GetAllRequest(Request):
},
"last_update": {
"description": (
"List of last_update constraint strings (utcformat, epoch) with an optional prefix "
"List of last_update constraint strings, or a single string (utcformat, epoch) with an optional prefix "
"modifier (>, >=, <, <=)"
),
"items": {"pattern": "^(>=|>|<=|<)?.*$", "type": "string"},
"type": ["array", "null"],
"type": ["string", "array", "null"],
},
"name": {
"description": "Get only models whose name matches this pattern (python regular expression syntax)",
@ -2621,9 +2621,11 @@ class GetAllRequest(Request):
self._property_last_update = None
return
self.assert_isinstance(value, "last_update", (list, tuple))
self.assert_isinstance(value, "last_update", (str, list, tuple))
if not isinstance(value, six.string_types):
self.assert_isinstance(value, "last_update", six.string_types, is_array=True)
self.assert_isinstance(value, "last_update", six.string_types, is_array=True)
self._property_last_update = value
@schema_property("_all_")

View File

@ -8218,11 +8218,11 @@ class GetAllRequest(Request):
},
"status_changed": {
"description": (
"List of status changed constraint strings (utcformat, epoch) with an optional prefix modifier "
"List of status changed constraint strings, or a single string (utcformat, epoch) with an optional prefix modifier "
"(>, >=, <, <=)"
),
"items": {"pattern": "^(>=|>|<=|<)?.*$", "type": "string"},
"type": ["array", "null"],
"type": ["string", "array", "null"],
},
"system_tags": {
"description": "List of task system tags. Use '-' prefix to exclude system tags",
@ -8502,9 +8502,11 @@ class GetAllRequest(Request):
self._property_status_changed = None
return
self.assert_isinstance(value, "status_changed", (list, tuple))
self.assert_isinstance(value, "status_changed", (str, list, tuple))
if not isinstance(value, six.string_types):
self.assert_isinstance(value, "status_changed", six.string_types, is_array=True)
self.assert_isinstance(value, "status_changed", six.string_types, is_array=True)
self._property_status_changed = value
@schema_property("search_text")