2011-08-23 59 views
0

我正在使用python從xira-rpc獲取Jira中的問題。除了缺少返回字典中的「解決方案」字段之外,它工作良好。例如「固定」,或「WontFix」等如何從Jira使用python和XML-RPC獲得「解決方案」

這是我從吉拉得到問題:

import xmlrpclib 

s = xmlrpclib.ServerProxy('http://myjira.com/rpc/xmlrpc') 
auth = s.jira1.login('user', 'pass') 
issue = s.jira1.getIssue(auth, 'PROJ-28') 

print issue.keys() 

這是我回來的字段列表:

['status', 'project', 'attachmentNames', 'votes', 'updated', 
'components', 'reporter', 'customFieldValues', 'created', 
'fixVersions', 'summary', 'priority', 'assignee', 'key', 
'affectsVersions', 'type', 'id', 'description'] 

的全部內容是:

{'affectsVersions': [{'archived': 'false', 
         'id': '11314', 
         'name': 'v3.09', 
         'released': 'false', 
         'sequence': '7'}], 
'assignee': 'myuser', 
'attachmentNames': '2011-08-17_attach.tar.gz', 
'components': [], 
'created': '2011-06-14 12:33:54.0', 
'customFieldValues': [{'customfieldId': 'customfield_10040', 'values': ''}, 
         {'customfieldId': 'customfield_10010', 
         'values': 'Normal'}], 
'description': "Blah blah...\r\n", 
'fixVersions': [], 
'id': '28322', 
'key': 'PROJ-28', 
'priority': '3', 
'project': 'PROJ', 
'reporter': 'myuser', 
'status': '1', 
'summary': 'blah blah...', 
'type': '1', 
'updated': '2011-08-18 15:41:04.0', 
'votes': '0'} 

當我這樣做:

resolutions = s.jira1.getResolutions(auth) 
pprint.pprint(resolutions) 

我得到:

[{'description': 'A fix for this issue is checked into the tree and tested.', 
    'id': '1', 
    'name': 'Fixed'}, 
{'description': 'The problem described is an issue which will never be fixed.', 
    'id': '2', 
    'name': "Won't Fix"}, 
{'description': 'The problem is a duplicate of an existing issue.', 
    'id': '3', 
    'name': 'Duplicate'}, 
{'description': 'The problem is not completely described.', 
    'id': '4', 
    'name': 'Incomplete'}, 
{'description': 'All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.', 
    'id': '5', 
    'name': 'Cannot Reproduce'}, 
{'description': 'Code is checked in, and is, er, ready for build.', 
    'id': '6', 
    'name': 'Ready For Build'}, 
{'description': 'Invalid bug', 'id': '7', 'name': 'Invalid'}] 

的吉拉版本V4.1.1是522#,我使用Python 2.7。

任何想法,爲什麼我沒有得到一個'決議'領域?

謝謝!

回答

2

答案是JiraXmlRpcService.java中的getIssue方法使用RemoteIssue對象調用makeIssueStruct。 RemoteIssue對象包含Resolution字段,但makeIssueStruct僅複製設置的值。所以如果沒有設置Resolution,它將不會出現在那裏的Hashtable中。

+0

如果可能,我建議使用SOAP而不是XML-RPC。 – mdoar

+0

啊......是的,我現在看到它時,當我看到一個問題的決議。謝謝! –

相關問題