当前位置: 首页>>代码示例>>Python>>正文


Python Ticket.values['description']方法代码示例

本文整理汇总了Python中trac.ticket.Ticket.values['description']方法的典型用法代码示例。如果您正苦于以下问题:Python Ticket.values['description']方法的具体用法?Python Ticket.values['description']怎么用?Python Ticket.values['description']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trac.ticket.Ticket的用法示例。


在下文中一共展示了Ticket.values['description']方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_ticket_for_lineitem

# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['description'] [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
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:27,代码来源:webui.py

示例2: generateTracTickets

# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['description'] [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"
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:88,代码来源:testRuns.py

示例3: generateTracTickets

# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values['description'] [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"
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:104,代码来源:testRuns.py


注:本文中的trac.ticket.Ticket.values['description']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。