From d999f515bb5f0b259c84a39a66deeb31cc63b138 Mon Sep 17 00:00:00 2001 From: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> Date: Wed, 23 Oct 2024 22:17:09 -0500 Subject: [PATCH 1/2] JIRA Finding Groups: Accommodate status function inconsistency --- dojo/jira_link/helper.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dojo/jira_link/helper.py b/dojo/jira_link/helper.py index fb0eab686eb..d33dab4d702 100644 --- a/dojo/jira_link/helper.py +++ b/dojo/jira_link/helper.py @@ -159,7 +159,13 @@ def can_be_pushed_to_jira(obj, form=None): elif isinstance(obj, Finding_Group): if not obj.findings.all(): return False, f"{to_str_typed(obj)} cannot be pushed to jira as it is empty.", "error_empty" - if "Active" not in obj.status(): + # Accommodating a strange behavior where a finding group sometimes prefers `obj.status` rather than `obj.status()` + try: + not_active = "Active" not in obj.status() + except TypeError: # TypeError: 'str' object is not callable + not_active = "Active" not in obj.status + # Determine if the finding group is not active + if not_active: return False, f"{to_str_typed(obj)} cannot be pushed to jira as it is not active.", "error_inactive" else: From 58fe271c2feaddacdd759553d99a19c3ab863fd4 Mon Sep 17 00:00:00 2001 From: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> Date: Wed, 23 Oct 2024 22:17:31 -0500 Subject: [PATCH 2/2] Fix ruff --- dojo/jira_link/helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dojo/jira_link/helper.py b/dojo/jira_link/helper.py index d33dab4d702..860f4f01d1b 100644 --- a/dojo/jira_link/helper.py +++ b/dojo/jira_link/helper.py @@ -162,7 +162,7 @@ def can_be_pushed_to_jira(obj, form=None): # Accommodating a strange behavior where a finding group sometimes prefers `obj.status` rather than `obj.status()` try: not_active = "Active" not in obj.status() - except TypeError: # TypeError: 'str' object is not callable + except TypeError: # TypeError: 'str' object is not callable not_active = "Active" not in obj.status # Determine if the finding group is not active if not_active: