JIRA: Problem with transitions
I've a script, it shows me all transition id's for a ticket. This script shows these transitions for a ticket:
ID: 11, Name: In Bearbeitung ID: 21, Name: On Hold ID: 31, Name: Schliessung ID: 141, Name: Frist verlängern ID: 101, Name: False Positive
If I use this code with the same Ticket:
jira = Jira(url = '[https://%s](https://%25s/)' % config['credentials']['atlassian_host'], username = config['credentials']['atlassian_user'], password = config['credentials']['atlassian_pass'])
fields = {
"duedate": list_issues[issue],
}
jira.set_issue_status(issue, "Frist verlängern ", fields)
I get this error: "requests.exceptions.HTTPError: 'transition'-ID muss eine Ganzzahl sein" (translated: 'transition' ID must be an integer) What can be the problem? If I use the method: jira.set_issue_status_by_transition_id(issue, 141) it does work but I cant set the field parameter and I need it there.
Could it be a problem with the umlauts in transition name (german "special" character like äüö etc)?
The umlauts are not the problem... This method is IMHO "buggy":
def get_transition_id_to_status_name(self, issue_key, status_name):
for transition in self.get_issue_transitions(issue_key):
if status_name.lower() == transition["to"].lower():
return int(transition["id"])
if I list the transitions with get_issue_transitions(issue_key) I get a list with transition NAME elements BUT the get_transition_id_to_status_name method returns transition TO elements.
@MAngel666 yup, that's the problem to fix. You can make a bypass by overwtirring method on the instance using:
from types import MethodType
def new_get_transition_id_to_status_name(connector, issue_key, status_name):
for transition in connector.get_issue_transitions(issue_key):
if status_name.lower() == transition["name"].lower():
return int(transition["id"])
jira.get_transition_id_to_status_name = MethodType(new_get_transition_id_to_status_name, jira)
Work as well with using Jira instance as context manager.