Changeset 66

Show
Ignore:
Timestamp:
07/27/07 19:18:26 (1 year ago)
Author:
edsuom
Message:

Much improve foss.tellectual.com index page

Files:

Legend:

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

    r65 r66  
    183183        resource to it is returned instead of a TracResource. 
    184184        """ 
    185         def extendRequest(*newSegments): 
    186             newSegments = list(newSegments) 
    187             request.postpath.extend(newSegments) 
    188             subSegments.extend(newSegments) 
    189             addition = "/" + "/".join(newSegments) 
    190             request.uri = request.uri.rstrip("/") + addition 
    191  
    192185        def rootState(segmentList): 
    193186            root = segmentList[0] 
     
    199192            return root, False 
    200193 
     194        def listOp(methodName, *args): 
     195            uriList = request.uri.split("/") 
     196            k = len(uriList) - len(segments) 
     197            uriPreList, uriPostList = uriList[:k], uriList[k:] 
     198            for thisList in (request.postpath, subSegments, uriPostList): 
     199                getattr(thisList, methodName)(*args) 
     200            request.uri = "/".join(uriPreList + uriPostList) 
     201 
    201202        projectName, subSegments = segments[0], list(segments[1:]) 
    202203        if not subSegments: 
    203             extendRequest('wiki') 
     204            listOp('append', 'wiki') 
    204205        root, isAtRoot = rootState(subSegments) 
     206        if root == 'wiki' and len(subSegments) > 1: 
     207            subRoot = subSegments[1] 
     208            if subRoot.isalpha() and subRoot.islower(): 
     209                listOp('remove', 'wiki') 
     210                root = subRoot 
    205211        if root == 'api': 
    206212            return self.apiDocResource, [projectName] + subSegments[1:] 
     
    209215        if isAtRoot: 
    210216            if root == 'wiki': 
    211                 extendRequest("Start_%s" % projectName) 
     217                listOp('append', "Start_%s" % projectName) 
    212218            elif root == 'browser': 
    213                 extendRequest('projects', projectName, 'trunk'
     219                listOp('extend', ['projects', projectName, 'trunk']
    214220        possibleResult = self._possibleStatic('trac', *subSegments) 
    215221        if possibleResult: 
  • projects/Twisted-Goodies/trunk/twisted_goodies/simpleserver/pop3.py

    r38 r66  
    2020""" 
    2121 
    22 import os.path as ospath 
     22import os.path 
    2323from zope.interface import implements 
    2424from twisted.internet import defer, protocol 
     
    4747        if pop3.IMailbox not in interfaces: 
    4848            raise NotImplementedError(self, interfaces) 
    49         thisMaildir = ospath.join(self.baseDir, avatarId) 
     49        thisMaildir = os.path.join(self.baseDir, avatarId) 
    5050        avatar = maildir.MaildirMailbox(thisMaildir) 
    5151        result = (pop3.IMailbox, avatar, self.logout)