本文整理汇总了Python中trac.ticket.Ticket.values['summary']方法的典型用法代码示例。如果您正苦于以下问题:Python Ticket.values['summary']方法的具体用法?Python Ticket.values['summary']怎么用?Python Ticket.values['summary']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.ticket.Ticket
的用法示例。
在下文中一共展示了Ticket.values['summary']方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_ticket_for_lineitem
# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['summary'] [as 别名]
def create_ticket_for_lineitem (self, req, id, addMesage, lineitem, summary=None):
#skip line items that have a ticket
if re.search('/ticket/\d+', lineitem.description): return
compname = 'Estimate-'+str(id)
if summary: compname = summary
ensure_component(self.env, compname, req.authname)
t = Ticket(self.env)
# try to split on a newline or space that is less than 80 chars into the string
idx = lineitem.description.find('\n', 0, 80)
if idx < 0: idx = lineitem.description.find(' ', 45, 80)
if idx < 0: idx = 45
summary = lineitem.description[:idx]
desc = lineitem.description
desc += "\n\nFrom [/Estimate?id=%s Created From Estimate %s]" % \
(lineitem.estimate_id,lineitem.estimate_id)
t.values['summary'] = summary
t.values['description'] = desc
t.values['status'] = 'new'
t.values['reporter'] = req.authname
t.values['component'] = compname
t.values['estimatedhours'] = avg(lineitem.low, lineitem.high)
t.insert()
lineitem.description+="\n\nCreated as /ticket/%s" % (t.id, )
return t
示例2: import_tickets
# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['summary'] [as 别名]
def import_tickets(self):
trac_cursor = self.env.get_db_cnx().cursor()
peer = SymfonyErrorPeer(self.env)
owners = {}
trac_cursor.execute("select owner, name from component")
for name, owner in trac_cursor:
owners[name] = owner
for error in peer.select_grouped():
# ticket with current hash key not exists ?
trac_cursor.execute("select ticket from ticket_custom where name = 'symfony_error_key' and value = '%s'" % error['hash_key'])
existing = trac_cursor.fetchone()
if not existing:
ticket = Ticket(self.env)
ticket.values['summary'] = 'Bug #' + error['hash_key'] + ' ' + error['message']
ticket.values['symfony_error_key'] = error['hash_key']
ticket.values['reporter'] = 'cron'
ticket.values['resolution'] = 'new'
ticket.values['status'] = 'new'
ticket.values['milestone'] = '0.3.1'
if error['module_name'] in owners:
owner = owners[error['module_name']]
else:
owner = self.default_owner
ticket.values['owner'] = owner
ticket.insert()
示例3: generateTracTickets
# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['summary'] [as 别名]
def generateTracTickets( self, req ) :
"""
ok, it's a post so we know we are supposed to go ahead and create some TRAC tickets...the parameters that we care about are:
#users ...this will be a list...
#testtemplates ... this will be a list...
#testcases ... this will be a list...
#version...this will be a string...
#milestone...this will be a string...
This method does one of two things. It will either return: "True, URL" if ticket creation based on user input was succesful or "False, ErrorMessage" if
the ticket creation failed.
"""
#grab the parameters that we care about out of the request object
testRunDescription = str( req.args.get('testrundescription') )
users = req.args.get('users')
testTemplates = req.args.get('testtemplates')
testcases = req.args.get('testcases')
version = str( req.args.get('selectedversion'))
milestone = str( req.args.get('selectedmilestone'))
#-----------------------------------ERROR CHECKING ON PARAMETERS--------------------------------------------
if version == None:
version = ""
if milestone == None:
milestone = ""
if users == None :
return False, "No users selected for test run"
if isinstance( users, unicode):
users = [users.encode('ascii', 'ignore')]
version = version.encode('ascii', 'ignore').strip()
milestone = milestone.encode('ascii', 'ignore').strip()
if testcases == None :
testcases = [] #so we don't get a blow up later...
if testTemplates == None :
return False, "must select at least one testcase or test template to create a test run"
return 'errorCreatingTestRun.cs', None
elif testTemplates == None :
testTemplates = []
#create combined testcase list
testcases = self.createCombinedTestCaseList( testTemplates, testcases, req )
allTestcases = self.properties.getTestCases( self, req ) #fetch the testcases...
if allTestcases == None :
return False, None
#--------------------------------------------DONE ERROR CHECKING -----------------------------------------------
#ok this is where we actually create the tickets...
db = self.env.get_db_cnx()
for aUser in users :
for testId in testcases :
testId = testId.encode('ascii', 'ignore').strip()
if testId in allTestcases :
test = allTestcases[ testId ]
ticket = Ticket(self.env, db=db)
ticket.populate(req.args)
ticket.values['reporter'] = req.authname #the reporter is whoever is logged in
ticket.values['summary'] = "TestID: " + test.getId() + " -- " + test.getSummary()
ticket.values['description'] = "''''''Test Details:''''''\n\n" + test.getDescription() + "\n\n''''''Expected result:'''''' \n\n" + test.getExpectedResult()
ticket.values['type'] = 'testcase'
ticket.values['status'] = 'new'
ticket.values['action'] = 'create'
ticket.values['component'] = test.getComponent()
ticket.values['owner'] = aUser
ticket.values['version'] = version
ticket.values['milestone'] = milestone
ticket.values['keywords'] = "Test_ver" + version + "_mile_" + milestone
#self._validate_ticket(req, ticket) #probably should validate the ticket here.
ticket.insert(db=db)
db.commit()
else:
return False, "The test " + testId + " specified in a test template or as the testcaseID in the test file does not exist in the master test list "
#ok blow away the session vars incase someone trys to refresh the created test run page...no need to recreate all the tickets again...
#thanks to the haxs in the reporty.py module...
for var in ('users', 'testcases', 'testtemplates','milestone','version'):
if req.session.has_key(var):
del req.session[var]
#redirect to a custom query report showing the created tickets
return True, req.base_url + "/query?status=new&status=assigned&status=reopened&testcase_result=&version=" + version + "&milestone=" + milestone + "&type=testcase&order=priority&group=owner"
示例4: generateTracTickets
# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['summary'] [as 别名]
#.........这里部分代码省略.........
if version == None:
version = ""
if milestone == None:
milestone = ""
if users == None :
return False, "No users selected for test run"
#check to see if the user, templates or testcases parameters is a str/unicode or a list (well if it isn't a unicode or str then it is a list)
if isinstance( users, unicode):
users = [users]
if isinstance( users, str):
users = [TracText.to_unicode ( users )]
if isinstance( testcases, unicode) :
testcases = [testcases]
if isinstance( testcases, str ):
testcases = [testcases]
if isinstance( testTemplates, unicode) :
testTemplates = [testTemplates]
if isinstance( testTemplates, str ):
testTemplates = [TracText.to_unicode ( testTemplates) ]
version = TracText.to_unicode ( version).strip()
milestone = TracText.to_unicode ( milestone ).strip()
if testcases == None :
testcases = [] #so we don't get a blow up later...
if testTemplates == None :
return False, "must select at least one testcase or test template to create a test run"
elif testTemplates == None :
testTemplates = []
#--------------------------------------------DONE ERROR CHECKING -----------------------------------------------
#create combined testcase list
testcases = self.createCombinedTestCaseList( testTemplates, testcases, req )
allTestcases, errors = self.properties.getTestCases( self, req ) #fetch the testcases...
if errors :
return False, errors
if allTestcases == None :
return False, None
#one last validation step
errorMessages = []
for aUser in users :
for testId in testcases :
testId = TracText.to_unicode( testId ).strip()
if testId in allTestcases :
continue
else:
self.env.log.info( "Testcase : " + testId + " not found in master list " )
errorMessages.append( "The test: " + testId + ", doesn't match it's file name or you've specified it wrong in the testtemplates.xml file" )
if errorMessages:
return False, errorMessages
#ok this is where we actually create the tickets...
db = self.env.get_db_cnx()
for aUser in users :
for testId in testcases :
testId = testId.encode('ascii', 'ignore').strip()
if testId in allTestcases :
test = allTestcases[ testId ]
ticket = Ticket(self.env, db=db)
ticket.populate(req.args)
ticket.values['reporter'] = req.authname #the reporter is whoever is logged in
ticket.values['summary'] = "TestID: " + test.getId() + " -- " + testConfiguration
ticket.values['description'] = "''''''Test Details:''''''\n\n" + test.getDescription() + "\n\n''''''Expected result:'''''' \n\n" + test.getExpectedResult()
ticket.values['type'] = 'testcase'
ticket.values['status'] = 'new'
ticket.values['action'] = 'create'
ticket.values['component'] = test.getComponent()
ticket.values['owner'] = aUser
ticket.values['version'] = version
ticket.values['milestone'] = milestone
ticket.values['keywords'] = testRunKeyWord
#self._validate_ticket(req, ticket) #probably should validate the ticket here.
ticket.insert(db=db)
db.commit()
else:
return False, "The test " + testId + " specified in a test template or as the testcaseID in the test file does not exist in the master test list "
#ok blow away the session vars incase someone trys to refresh the created test run page...no need to recreate all the tickets again...
#thanks to the haxs in the reporty.py module...
for var in ('users', 'testcases', 'testtemplates','milestone','version'):
if req.session.has_key(var):
del req.session[var]
#redirect to a custom query report showing the created tickets
return True, req.base_url + "/query?status=new&status=assigned&status=reopened&status=accepted&testcase_result=&version=" + version + "&milestone=" + milestone + "&type=testcase&order=priority&group=owner"