All pastes #992591 Raw Edit

Unnamed

public text v1 · immutable
#992591 ·published 2008-04-21 22:48 UTC
rendered paste body
            else:
                os.mkdir(receivedFilesDirSub)
                # ugly, but "if os.mkdir(..)" doesn't work :S
                if os.path.exists(receivedFilesDirSub):
                    receivedFilesDir = receivedFilesDirSub
                    # if we can't create the dir, we put the file directly 
                    # in received files dir
        
        #os.path.join(receivedFilesDir, self.getFilename())
        path = receivedFilesDir+'/'
        
        num = 0
        increaseIt = self.getFilename()
        
        while os.path.exists(path + increaseIt):
            num += 1
            myFile = self.getFilename()
            myLen = len(myFile)
            lastDot = myFile.rfind(".")
            lastChar = myLen-lastDot#12-9
            second = myFile[lastDot:]
            first = myFile[:-lastChar]
            increaseIt=first+str(num)+second
			
			
        self.localPath = path + increaseIt
        
        # we don't copy because the permissions may be too restrictive
        # and not match the user preferred umask blah blah