Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira + Python : Issue while categorize the issues based on issue type.

Sunesh M S September 8, 2018

 

Hi All,

The below highlighted conditions are not working as expected. 

for Issue in jira.search_issues('project=YKP and assignee='+ Assignee +
' and status not in ("Done", "Released", "Discarded") ORDER BY issuekey, issuetype'):
if (Issue.fields.issuetype == 'Epic'):
print(Issue.fields.issuetype)
print("---" + '{} | {} | {} | {}'.format(Issue.key,Issue.fields.issuetype, Issue.fields.summary, Issue.fields.status))
if (Issue.fields.issuetype=='Story'):
print(Issue.fields.issuetype)
print("---" + '{} | {} | {} | {}'.format(Issue.key, Issue.fields.issuetype, Issue.fields.summary, Issue.fields.status))

 

I have tried all the combinations like below,

if (Issue.fields.issuetype == 'Epic'):

if (Issue.fields.issuetype == "Epic"):

if (Issue.fields.issuetype in ['Epic']):

Could you please help me to sort out the issue?

 

Thanks in Advance,

Maadi.

 

1 answer

1 accepted

1 vote
Answer accepted
Mohamed Benziane
Community Champion
September 9, 2018

Hello Sunesh,

 

The datatype of issuetype is 'class 'jira.resources.IssueType' and you value 'Epic' is string so you have to convert you  issuetype class into a string.


if str(i.fields.issuetype)=='Story':
'your code'

Feel free to place print instructions like this 'print (type<your variable or anything else') to know the datatype and if you need to convert something.

 

Sorry for my english is not my native language

Hope it help 

Sunesh M S September 9, 2018

Thanks a lot @Mohamed Benziane. That's worked.

Mohamed Benziane
Community Champion
September 9, 2018

you're welcome, i'm glad i helped you.

 

Feel free to tag your question as solved may be it will help other people.

Sunesh M S September 9, 2018

[Solved]

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events