示例#1
0
def deleteFile(fileId, filename):

    userId = RetrieveSessionDetails('userId')
    currentFolderId = RetrieveSessionDetails('currentFolderId')

    parentFolderId, parentfolderName = BusinessLayer.getParentFolderForFile(
        fileId, userId)
    print("kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk: ", parentFolderId)
    print("llllllllllllllllllllllllllllllllllllllllll: ", parentfolderName)

    flag = BusinessLayer.RemoveExisitngFile(userId, currentFolderId, fileId,
                                            filename)

    if flag == True:

        try:
            path = BusinessLayer.getPathForFolder(userId, parentFolderId)
            target = os.path.join(APP_STORAGE_PATH, path)
            destination = "/".join([target, filename])
            os.remove(destination)
            AddToSession('TotalSize', BusinessLayer.getTotalSize(userId))

        except OSError:
            pass

    return redirect(url_for('index', folderId=currentFolderId))
示例#2
0
文件: app.py 项目: pnjha/DropBox
def deleteFile(fileId,filename):
    userId = RetrieveSessionDetails('userId')
    currentFolderId = RetrieveSessionDetails('currentFolderId')
    flag = BusinessLayer.RemoveExisitngFile(userId,currentFolderId,fileId,filename)    

    AddToSession('TotalSize',BusinessLayer.getTotalSize(userId))

    return redirect(url_for('index',folderId = currentFolderId))