1

如何使用 Pyral 为 Rally 缺陷创建讨论项?

这是我到目前为止所拥有的:

rally = Rally(server, user, password)
rally.enableLogging('rallyConnection.log')
rally.setProject("RallyTestPrj")

defectID = 'DE9221'
notes = "Adding new note from Python"
discussion = "Adding discussion from Python"

defect_data = { "FormattedID" : defectID,
                "Notes"       : notes,
                "Discussion"  : discussion
}

try:
defect = rally.update('Defect', defect_data)
except Exception, details:
sys.stderr.write('ERROR: %s \n' % details)
sys.exit(1)
print "Defect updated"
4

1 回答 1

1

实际上,集会中的讨论项是集会神器,就像缺陷、故事或任务一样。为了做你想做的事,你需要创建一个新的 Discussion 工件(或在集会 API 术语中的 ConversationPost),并告诉它与哪个现有工件(在你的情况下是缺陷)相关联。

rally = Rally(server, user, password)
rally.enableLogging('rallyConnection.log')
rally.setProject("RallyTestPrj")

defectID = 'DE9221'
discussion_text = "Adding discussion from Python"

# get the defect entity so we can grab the defect oid which we'll need when
# creating the new ConversationPost
defect = rally.get('Defect', query='FormattedID = %s' % defectID, instance=True)

discussion_data = {"Artifact": defect.oid, "Text": discussion_text}

# create the discussion
try:
    discussion = rally.create('ConversationPost', discussion_data)
except Exception, details:
    sys.stderr.write('ERROR: %s \n' % details)
    sys.exit(1)
print "Defect updated with a new discussion entry"
于 2013-04-05T08:21:15.090 回答