示例#1
0
文件: fileMgr.py 项目: twoconk/DimSim
def deletePrivateFiles(meetingID):
    # JSON Response BEGIN (error message)
    jsonError = jsonObject()
    jsonError.clearResponse()
    jsonError.add('result','false')
    jsonError.add('method','deletePrivateFiles')
    #JSON Response END
    
    # JSON Response BEGIN (success message)
    jsonSuccess = jsonObject()
    jsonSuccess.clearResponse()
    jsonSuccess.add('result','true')
    jsonSuccess.add('method','deletePrivateFiles')
    #JSON Response END
    
    if meetingID == '':
        return jsonError.jsonResponse()
    
    pathEntries = filehelper.searchPathByKeyword(filemgrArchive, meetingID)
    
    if len(pathEntries) == 0:
        return jsonError.jsonResponse()
    
    if sys.platform.startswith('win'):
        accessPath = filemgrArchive + '\\' + meetingID
    else:
        accessPath = filemgrArchive + '/' + meetingID

    try:
        shutil.rmtree(accessPath)
    except:
        return jsonError.jsonResponse()
            
    return jsonSuccess.jsonResponse()
示例#2
0
文件: fileMgr.py 项目: twoconk/DimSim
def deleteImageFiles(meetingID):
    # JSON Response BEGIN (error message)
    jsonError = jsonObject()
    jsonError.clearResponse()
    jsonError.add('result','false')
    jsonError.add('method','deleteImageFiles')
    #JSON Response END
    
    # JSON Response BEGIN (success message)
    jsonSuccess = jsonObject()
    jsonSuccess.clearResponse()
    jsonSuccess.add('result','true')
    jsonSuccess.add('method','deleteImageFiles')
    #JSON Response END
    
    if meetingID == '':
        return jsonError.jsonResponse()
    
    pathEntries = filehelper.searchPathByKeyword(filemgrArchive, meetingID)
    
    if len(pathEntries) == 0:
        return jsonError.jsonResponse()
    
    if sys.platform.startswith('win'):
        accessPath = filemgrArchive + '\\' + meetingID
    else:
        accessPath = filemgrArchive + '/' + meetingID

    try:
        for root, dirs, files in os.walk(accessPath):
            for name in files:
                if string.find(name, 'dimdim_logo.') >= 0:
                    if sys.platform.startswith('win'):
                        os.remove(accessPath + '\\' + name)
                    else:
                        os.remove(accessPath + '/' + name)
    except:
        return jsonError.jsonResponse()
           
    return jsonSuccess.jsonResponse()