kopia lustrzana https://github.com/Langenfeld/py-gitea
removed page iteration from listing issues as "-1" is a valid parameter for the api listing all issues
rodzic
257abeb13b
commit
11bf6f8dc9
|
@ -185,18 +185,13 @@ class Repository(GiteaApiObject):
|
||||||
def get_issues_state(self, state) -> List[GiteaApiObject]:
|
def get_issues_state(self, state) -> List[GiteaApiObject]:
|
||||||
"""Get issues of state Issue.open or Issue.closed of a repository."""
|
"""Get issues of state Issue.open or Issue.closed of a repository."""
|
||||||
assert state in [Issue.OPENED, Issue.CLOSED]
|
assert state in [Issue.OPENED, Issue.CLOSED]
|
||||||
index = 1
|
|
||||||
issues = []
|
issues = []
|
||||||
while True:
|
# "page": -1 is returning _all_ issues instead of pages. Hopefully this is intended behaviour.
|
||||||
# q=&type=all&sort=&state=open&milestone=0&assignee=0
|
data = {"page": -1, "state": state}
|
||||||
results = self.gitea.requests_get(Repository.REPO_ISSUES % (self.owner.username, self.name),
|
results = self.gitea.requests_get(Repository.REPO_ISSUES % (self.owner.username, self.name), params=data)
|
||||||
params={"page": index, "state": state})
|
|
||||||
if len(results) <= 0:
|
|
||||||
break
|
|
||||||
index += 1
|
|
||||||
for result in results:
|
for result in results:
|
||||||
issue = Issue.parse_request(self.gitea, result)
|
issue = Issue.parse_request(self.gitea, result)
|
||||||
# again a hack because this infomation gets lost after the api call
|
# adding data not contained in the issue answer
|
||||||
setattr(issue, "repo", self.name)
|
setattr(issue, "repo", self.name)
|
||||||
setattr(issue, "owner", self.owner)
|
setattr(issue, "owner", self.owner)
|
||||||
issues.append(issue)
|
issues.append(issue)
|
||||||
|
|
Ładowanie…
Reference in New Issue