Techdebt - Allow OrderedDict when paginating (#6725)

This commit is contained in:
Bert Blommers 2023-08-25 20:01:36 +00:00 committed by GitHub
parent a1adf241b4
commit 18e382c8ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,6 @@ def paginate(pagination_model: Dict[str, Any]) -> Any:
def pagination_decorator(func: Any) -> Any:
@wraps(func)
def pagination_wrapper(*args: Any, **kwargs: Any) -> Any: # type: ignore
method = func.__name__
model = pagination_model
pagination_config = model.get(method)
@ -137,8 +136,10 @@ class Paginator:
return False
unique_attributes = self._parsed_token["uniqueAttributes"]
predicate_values = unique_attributes.split("|")
for (index, attr) in enumerate(self._unique_attributes):
curr_val = item[attr] if type(item) == dict else getattr(item, attr, None)
for index, attr in enumerate(self._unique_attributes):
curr_val = (
item[attr] if isinstance(item, dict) else getattr(item, attr, None)
)
if not str(curr_val) == predicate_values[index]:
return False
return True