如何使用jira-python设置fixVersions字段

时间:2013-01-24 06:47:42

标签: python jira python-jira

我正在尝试使用jira-python模块(http://jira-python.readthedocs.org/en/latest/)更新现有的JIRA。具体来说,我正在尝试设置问题的fixesVersion列表。我一直试着没有运气。我错过了什么?

issue = jira.issue('DUC-391')
issue_dict = { 'fixVersions' : [{'id': '10115'}] }
issue.update(fields=issue_dict)

返回stackTrace:

Traceback (most recent call last):
  File "post-commit-jira.py", line 35, in <module>
    issue.update(fields=issue_dict)
  File "/Library/Python/2.6/site-packages/jira/resources.py", line 193, in update
    super(Issue, self).update(**data)
  File "/Library/Python/2.6/site-packages/jira/resources.py", line 72, in update
    raise_on_error(r)
  File "/Library/Python/2.6/site-packages/jira/exceptions.py", line 29, in raise_on_error
    error = errorMessages[0]

2 个答案:

答案 0 :(得分:3)

查看https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Edit+issues中组件的添加,设置和删除示例 您可以使用名称而不是有用的ID,例如

issue_dict = { 'fixVersions' : [{'add': {'name': 'Name of the version 10115'}}] }

答案 1 :(得分:1)

用它玩了更多,意识到错误。

由于某些必填字段未设置而失败。在原始问题中剪切的代码是可以的,但jira-python库中的错误报告却有很多不足之处......