Skip to content

Commit

Permalink
Remove workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
Spacetown authored Mar 6, 2024
1 parent 3d4b8b9 commit 254c250
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions atlassian/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def _get_paged(
flags=None,
trailing=None,
absolute=False,
paging_workaround=False,
):
"""
Used to get the paged data
Expand All @@ -43,17 +42,13 @@ def _get_paged(
:param flags: string[] (default is None): The flags
:param trailing: bool (default is None): If True, a trailing slash is added to the url
:param absolute: bool (default is False): If True, the url is used absolute and not relative to the root
:param paging_workaround: bool (default is False): If True, the paging is done on our own because
of https://jira.atlassian.com/browse/BCLOUD-13806
:return: A generator object for the data elements
"""

if self.cloud:
if params is None:
params = {}
if paging_workaround:
params["startAt"] = 0

while True:
response = super(Jira, self).get(
Expand All @@ -71,18 +66,15 @@ def _get_paged(
if response.get("isLast", False) or len(values) == 0:
break

if paging_workaround:
params["startAt"] += response["maxResults"]
else:
url = response.get("nextPage")
if url is None:
break
# From now on we have absolute URLs with parameters
absolute = True
# Params are now provided by the url
params = {}
# Trailing should not be added as it is already part of the url
trailing = False
url = response.get("nextPage")
if url is None:
break
# From now on we have absolute URLs with parameters
absolute = True
# Params are now provided by the url
params = {}
# Trailing should not be added as it is already part of the url
trailing = False
else:
raise ValueError("``_get_paged`` method is only available for Jira Cloud platform")

Expand Down

0 comments on commit 254c250

Please sign in to comment.