The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

[jira-python] Accessing a property including spaces

cscetbon
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 2, 2014

Hi,

I can access a property that has a space using the raw dictionary as follows :

jira.project('prj1').raw["roles"]['Product Manager']

u'https://xxxx..com/rest/api/2/project/10500/role/10201'

However how can I do it without using this dictionary like I do for other roles ?

jira.project('prj1').roles.Administrators

Out[84]: u'https://xxxx.com/rest/api/2/project/10500/role/10002'

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
CEDRIC ZABEL
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
August 25, 2014

First of all, there’s no reason to avoid using the raw dictionary. It’s part of the jira-python interface, it’s well-defined, and as you see, it works when names have spaces.

It turns out you are not asking a jira-python question. You’re just asking a python question: How do I access an object’s attribute using the dot notation when the attribute name has spaces in it? And the answer is that you can’t do it. You have to do something like use the “getattr” function, like so:

getattr(jira.project('prj1').roles, 'Product Manager')

There’s other ways in python to do it, but like I said, it’s really a python question.

TAGS
AUG Leaders

Atlassian Community Events