From 844b171921ebc0440735914c775a0b31e7b881e0 Mon Sep 17 00:00:00 2001 From: Jordan Woods <13803242+jorwoods@users.noreply.github.com> Date: Tue, 15 Oct 2024 08:50:33 -0500 Subject: [PATCH] fix: null out PaginationItem._page_number Tests were failing because the fetch_all method added a second check before fetching the next page. This fix will allow the next page to be retrieved when used normally --- tableauserverclient/server/query.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tableauserverclient/server/query.py b/tableauserverclient/server/query.py index 74f15f5f..801ad4a1 100644 --- a/tableauserverclient/server/query.py +++ b/tableauserverclient/server/query.py @@ -77,6 +77,7 @@ def __iter__(self: Self) -> Iterator[T]: for page in count(1): self.request_options.pagenumber = page self._result_cache = [] + self._pagination_item._page_number = None try: self._fetch_all() except ServerResponseError as e: @@ -141,6 +142,7 @@ def __getitem__(self, k): elif k in range(self.total_available): # Otherwise, check if k is even sensible to return self._result_cache = [] + self._pagination_item._page_number = None # Add one to k, otherwise it gets stuck at page boundaries, e.g. 100 self.request_options.pagenumber = max(1, math.ceil((k + 1) / size)) return self[k]