2013-04-03 66 views
0

我怎樣才能爲反彈缺損Pyral創建一個討論議題?拉力賽的Python API:加入討論投奔

這是我到目前爲止有:

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" 

回答

0

事實上,在集會討論項目是反彈假象,就像一個缺陷,故事或任務。爲了做到你想要什麼,你需要創建一個新的討論神器(或ConversationPost拉力賽API條款),並告訴它現有工件(在你的情況下,缺陷)與自身關聯。

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"