Changeset 62

Show
Ignore:
Timestamp:
07/26/07 12:03:57 (1 year ago)
Author:
edsuom
Message:

Fix to foss.tellectual.com example; adding unit test subdirs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • projects/Twisted-Goodies/trunk/misc/var_www_foss.tellectual.com_index.py

    r59 r62  
    9393        self.apiDocResource = APIDocResource( 
    9494            vhostPath, self.projectURLProto, self.projectRepoProto) 
     95        self.downloadResource = DownloadResource( 
     96            vhostPath, self.projectRepoProto) 
     97 
    9598        self.title = "Ed Suominen's Free & Open Source Software Projects" 
    9699        self.style = { 
     
    188191            request.uri = request.uri.rstrip("/") + addition 
    189192 
     193        def rootState(segmentList): 
     194            root = segmentList[0] 
     195            if len(segmentList) == 1: 
     196                return root, True 
     197            if len(segmentList) == 2 and segmentList[1] == '': 
     198                del segmentList[1] 
     199                return root, True 
     200            return root, False 
     201 
    190202        projectName, subSegments = segments[0], list(segments[1:]) 
    191203        if not subSegments: 
    192204            extendRequest('wiki') 
    193         root = subSegments[0] 
     205        root, isAtRoot = rootState(subSegments) 
    194206        if root == 'api': 
    195207            return self.apiDocResource, [projectName] + subSegments[1:] 
    196         if len(subSegments) == 1: 
     208        if root == 'download': 
     209            return self.downloadResource, [projectName] + subSegments[1:] 
     210        if isAtRoot: 
    197211            if root == 'wiki': 
    198212                extendRequest("Start_%s" % projectName) 
    199213            elif root == 'browser': 
    200                 extendRequest('projects', projectName.lower(), 'trunk') 
     214                extendRequest('projects', projectName, 'trunk') 
    201215        possibleResult = self._possibleStatic('trac', *subSegments) 
    202216        if possibleResult: