2011-02-14 828 views
1

使用JIRA 4.2版。使用Python 2.7和suds 0.4,如何更新问题的自定义级联选择字段(父级和子级)?通过泡沫更新JIRA中的自定义级联选择字段

在“Python(SOAPPy)客户端”下有一个SOAPpy example。 我是unable to perform这种类型的更新使用Python JIRA CLI

示例: 当更新父字段customfield_10的级联选择自定义子级时,需要更新字段customfield_10_1。

更新

代码以显示级联字段的原始值:

issue = client.service.getIssue(auth, "NAHLP-33515") 
for f in fields: 
    if f['customfieldId'] == 'customfield_10050' or f['customfieldId'] == 'customfield_10050_1': 
     print f 

这导致:

(RemoteCustomFieldValue){ 
    customfieldId = "customfield_10050" 
    key = None 
    values[] = 
     "10981", 
} 

手动设置级联字段的孩子,上面的代码的结果后:

(RemoteCustomFieldValue){ 
    customfieldId = "customfield_10050" 
    key = None 
    values[] = 
     "10981", 
} 
(RemoteCustomFieldValue){ 
    customfieldId = "customfield_10050" 
    key = "1" 
    values[] = 
     "11560", 
} 

以上数值是我希望通过泡沫实现的。

注意key =“1”字段。键值指定该对象是customfield_10050的子项。
Documentation referenceparentKey - 用于多维自定义字段,如级联选择列表。空在其他情况下

让我们尝试发送键字段值:

client.service.updateIssue(auth, "NAHLP-33515", [ 
          {"id":"customfield_10050", "values":["10981"]}, 
          {"id":"customfield_10050_1", "key":"1", "values":["11560"]} 
          ]) 

这将导致一个错误,因为updateIssue接受RemoteFieldValue []参数,而不是一个RemoteCustomFieldValue []参数(thanks Matt Doar):

suds.TypeNotFound: Type not found: 'key' 

那么我们如何传递RemoteCustomFieldValue参数来更新问题呢?

更新2,mdoar的回答

冉下面通过泡沫代码:

client.service.updateIssue(auth, "NAHLP-33515", [ 
          {"id":"customfield_10050", "values":["10981"]}, 
          {"id":"customfield_10050_1", "values":["11560"]} 
          ])` 

值后:

(RemoteCustomFieldValue){ 
    customfieldId = "customfield_10050" 
    key = None 
    values[] = 
     "10981", 
} 

不幸的是,这不更新customfield_10050的孩子。手动验证。

分辨率:

谢谢mdoar!要更新级联选择字段的父级和子级,请使用冒号(':')指定子级字段。

工作例如:

client.service.updateIssue(auth, "NAHLP-33515", [ 
          {"id":"customfield_10050", "values":["10981"]}, 
          {"id":"customfield_10050:1", "values":["11560"]} 
          ]) 

回答