Browse Source

Don't use body when it is None.

master
poikilos 3 years ago
parent
commit
1ffae48821
  1. 15
      utilities/enissue.py

15
utilities/enissue.py

@ -302,8 +302,10 @@ def show_issue(issue):
return False return False
issue_data_s = decode_safe(issue_data_bytes) issue_data_s = decode_safe(issue_data_bytes)
issue_data = json.loads(issue_data_s) issue_data = json.loads(issue_data_s)
markdown = issue_data["body"] markdown = issue_data.get("body")
markdown = markdown.replace("\\r\\n", "\n").replace("\\t", "\t") # ^ It is (always?) present but allowed to be None by GitHub!
if markdown is not None:
markdown = markdown.replace("\\r\\n", "\n").replace("\\t", "\t")
left_w = 10 left_w = 10
spacer = " " spacer = " "
line_fmt = "{: <" + str(left_w) + "}" + spacer + "{}" line_fmt = "{: <" + str(left_w) + "}" + spacer + "{}"
@ -328,9 +330,12 @@ def show_issue(issue):
labels_s = ", ".join(neat_labels) labels_s = ", ".join(neat_labels)
print(line_fmt.format("labels:", labels_s)) print(line_fmt.format("labels:", labels_s))
print("") print("")
print('"""') if markdown is not None:
print(markdown) print('"""')
print('"""') print(markdown)
print('"""')
else:
print("(no description)")
if issue_data["comments"] > 0: if issue_data["comments"] > 0:
print("") print("")
print("") print("")

Loading…
Cancel
Save