Browse Source

Generate the comments URL when not specified by the response.

master
poikilos 3 years ago
parent
commit
661d7934e8
  1. 22
      utilities/enissue.py

22
utilities/enissue.py

@ -940,12 +940,26 @@ class Repo:
# #
data = tmln_data data = tmln_data
elif comments > 0: elif comments > 0:
comments_url = issue_data.get("comments_url")
if comments_url is None:
# if self.api_id == "Gitea":
comments_url = self.api_comments_url_fmt.format(
instance_url = self.instance_url,
ru=self.remote_user,
rn=self.repo_name,
)
if comments_url is not None:
cmts_data = self.getCachedJsonDict( cmts_data = self.getCachedJsonDict(
issue_data["comments_url"], comments_url,
refresh=refresh, refresh=refresh,
quiet=True, quiet=True,
) )
data = cmts_data data = cmts_data
else:
error("WARNING: comments={} but there is no"
" comments_url in:"
"".format(comments))
error(json.dumps(issue_data, indent=4, sort_keys=True))
for evt in data: for evt in data:
user = evt.get('user') user = evt.get('user')
@ -1125,6 +1139,7 @@ class Repo:
''' '''
matching_issue = None matching_issue = None
match_count = 0 match_count = 0
p = self.log_prefix
# TODO: get labels another way, and make this conditional: # TODO: get labels another way, and make this conditional:
# if mode == "list": # if mode == "list":
for issue in self.issues: for issue in self.issues:
@ -1150,7 +1165,10 @@ class Repo:
self.labels.append(label_s) self.labels.append(label_s)
else: else:
raise ValueError(p+"ERROR: The url '{}' does not" raise ValueError(p+"ERROR: The url '{}' does not"
" start with '{}'" " start with '{}'. Try refresh"
" if you've changed the"
" repository URL after a cached"
" page was saved"
"".format(label["url"], "".format(label["url"],
self.labels_url)) self.labels_url))
if len(match_all_labels) > 0: if len(match_all_labels) > 0:

Loading…
Cancel
Save