Changeset 4346

Show
Ignore:
Timestamp:
09/26/08 11:34:03 (3 months ago)
Author:
edunne
Message:

adding default _init_.py file to avoid warnings in easy install.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/properties.py

    r3908 r4346  
    1616import logging 
    1717import logging.handlers 
     18import trac.util.text as TracText 
    1819from trac import env 
    1920from trac.versioncontrol import api 
     
    3637        components = [] 
    3738        for c in Component.select(component.env) : 
    38             components.append(c.name
     39            components.append(TracText.to_unicode( c.name )
    3940        return components 
    4041         
     
    102103                    try: 
    103104                        content = entry.get_content().read() 
    104                         testcase = TestCase( entry.get_name(), str(content), component, entry.get_name() ) 
    105                         testcases[ testcase.getId().encode('ascii', 'ignore').strip() ] =  testcase  
    106                      
     105                        testcase = TestCase( TracText.to_unicode( entry.get_name() ), TracText.to_unicode(content), component, entry.get_name() ) 
     106                        testcases[ TracText.to_unicode ( testcase.getId() ).strip() ] =  testcase  
     107                        component.env.log.debug( "added testcase : " + testcase.getId() + "  FROM file : " + TracText.to_unicode( entry.get_name() ) ) 
    107108                    except Exception, ex: 
    108109                        errors.append( "The testcase  :" + entry.get_name() + "  is not well formed xml...a parse error occured " ) 
     
    115116            try: 
    116117                    currentTestcase = value #in case we do toss an exception I'll want some information from this testcase 
    117                     components.index( value.getComponent().encode('ascii', 'ignore').strip() ) #this will toss an exception if the component in the testcase doesn't exist in the trac project 
     118                    components.index( TracText.to_unicode( value.getComponent() ).strip() ) #this will toss an exception if the component in the testcase doesn't exist in the trac project 
    118119                     
    119120            except Exception, ex: 
     
    253254     
    254255    def getId(self) :  
    255         return self.id.encode('ascii', 'ignore').strip() 
     256        return self.id.strip() 
    256257     
    257258    def getSummary(self): 
     
    268269         
    269270    def __init__(self, testcasename, testCaseContent, component, fileName = None ) :  
    270         self.id = "" 
    271         self.summary = "" 
    272         self.description = "" 
    273         self.expectedresult = "" 
    274         self.component = "" 
    275         self.fileName = "" 
     271        self.id = unicode( '' ) 
     272        self.summary = unicode( '' ) 
     273        self.description = unicode( '' ) 
     274        self.expectedresult = unicode( '' ) 
     275        self.component = unicode( '' ) 
     276        self.fileName = unicode( '' ) 
    276277         
    277278        self.fileName = fileName 
     
    287288                for child in aNode.childNodes: 
    288289                    if child.nodeType == xml.dom.minidom.Node.TEXT_NODE : 
    289                         self.__dict__[a] += child.data 
     290                        self.__dict__[a] += TracText.to_unicode( child.data ) 
    290291                    #else...we don't care about other kinds of nodes...not that there should be any. 
    291292         
  • testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/testRuns.py

    r3704 r4346  
    1717import logging 
    1818import logging.handlers 
     19import trac.util.text as TracText 
    1920from trac.core import * 
    2021from trac.ticket import Component as TracComponent, Milestone, Ticket, TicketSystem  
     
    5152                #ok generate some tickets already... 
    5253                req.perm.assert_permission('TICKET_CREATE') #but first check to make sure they are allowed to create tickets... 
    53                 success, errorMessage_orQueryURL = self.generateTracTickets( req
     54                success, errorMessage_orQueryURL = self.generateTracTickets( req
    5455                 
    5556                if success: 
     
    5859                 
    5960                else: 
    60                      
    61                     data["errorMessage"] = errorMessage_orQueryURL  
     61                    data["errorMessage"] = "There is a configuration problem...issues listed below" 
     62                    data["errorsList"] = errorMessage_orQueryURL 
    6263                    return "testRunNotConfigured.html", data, None 
    6364                 
    6465            elif errors != None : 
    65                 self.env.log.info( "ARG!") 
    66                 data["errorMessage"] = errors 
    67                 return template, data, content_type 
     66                #self.env.log.info( "ARG!") 
     67                data["errorMessage"] = "There is a configuration problem...issues listed below"  
     68                data["errorsList"] = errors 
     69                return "testRunNotConfigured.html", data, None 
    6870                 
    6971            else:  
     
    103105        self.env.log.info( "TESTCASES" + repr(testcases) + " ERRORS : " + repr(errors) ) 
    104106         
     107        self.env.log.info( "LENGTH OF TESTCASES : " + str ( len( testcases ) ) ) 
     108         
    105109        if testcases == None or len(errors) > 0 :  
    106110            data["errorMessage"] = "No test cases found or other error...see list below if any" 
     
    110114        for key, testcase in testcases.iteritems(): 
    111115            testcaseNames.append( testcase.getId() ) 
     116            self.env.log.info( "Added test case id : " + testcase.getId()   + " to the list " ) 
     117         
    112118        testcaseNames.sort() 
    113119                 
     
    161167        if testRunKeyWord == None :  
    162168            testRunKeyWord = "" 
    163         testRunKeyWord = self.properties.trimOutAnyProblemStrings(testRunKeyWord)  #this is manually typed in...so it's probably to look for sqlInjection etc... 
     169        testRunKeyWord = self.properties.trimOutAnyProblemStrings(testRunKeyWord)  #this is manually typed in...so it's probably a good idea to look for sqlInjection etc... 
    164170         
    165171        if version == None: 
     
    172178        #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) 
    173179        if isinstance( users, unicode):  
    174             users = [users.encode('ascii', 'ignore')
     180            users = [users
    175181             
    176182        if isinstance( users, str):  
    177             users = [users]    
     183            users = [TracText.to_unicode ( users )]    
    178184 
    179185        if isinstance( testcases, unicode) : 
    180             testcases = [testcases.encode('ascii', 'ignore')
     186            testcases = [testcases
    181187         
    182188        if isinstance( testcases, str ): 
     
    184190         
    185191        if isinstance( testTemplates, unicode) : 
    186             testTemplates = [testTemplates.encode('ascii', 'ignore')
     192            testTemplates = [testTemplates
    187193             
    188194        if isinstance( testTemplates, str ): 
    189             testTemplates = [testTemplates
    190          
    191          
    192         version = version.encode('ascii', 'ignore').strip()   
    193         milestone = milestone.encode('ascii', 'ignore').strip() 
     195            testTemplates = [TracText.to_unicode ( testTemplates)
     196         
     197         
     198        version = TracText.to_unicode ( version).strip()   
     199        milestone = TracText.to_unicode ( milestone ).strip() 
    194200 
    195201        if testcases == None : 
     
    218224        for aUser in users :  
    219225            for testId in testcases :  
    220                 testId = testId.encode('ascii', 'ignore').strip() 
     226                testId = TracText.to_unicode( testId ).strip() 
    221227                if testId in allTestcases : 
    222228                    continue 
    223229                else: 
    224                      errorMessages.append( "The test: " + testId + ", doesn't match it's file name or you've specified it wrong in the testtemplates.xml file" ) 
     230                    self.env.log.info( "Testcase : " + testId + "  not found in master list " ) 
     231                    errorMessages.append( "The test: " + testId + ", doesn't match it's file name or you've specified it wrong in the testtemplates.xml file" ) 
     232         
    225233        if errorMessages: 
    226234            return False, errorMessages 
     
    263271 
    264272    def createCombinedTestCaseList( self, testTemplates, testcases, req ) : 
    265                   
     273         
    266274        if len(testTemplates) < 1 : 
    267275            return testcases #hopefully testcases isn't < 1 as well... 
     
    270278            tempTestCaseList = [] 
    271279            for name in testTemplates :  
    272                 name = name.encode('ascii', 'ignore'
     280                name = TracText.to_unicode ( name
    273281                name  = self.properties.trimOutAnyProblemStrings(name ) 
    274282                testIds = projTemplates.getTestsForTemplate( name )