(filename, mode='rb')
return kb.cache.content[filename]
Cached reading of file content (avoiding multiple same file reading)
Cached reading of file content (avoiding multiple same file reading)
Cached reading of file content ( avoiding multiple same file reading )
def readCachedFileContent(filename, mode='rb'):
    """
    Cached reading of file content (avoiding multiple same file reading)
    """

    if filename not in kb.cache.content:
        with kb.locks.cache:
            if filename not in kb.cache.content:
                checkFile(filename)
                try:
	                with openFile(filename, mode) as f:
	                    kb.cache.content[filename] = f.read()
                except (IOError, OSError, MemoryError), ex:
                    errMsg = "something went wrong while trying "
                    errMsg += "to read the content of file '%s' ('%s')" % (filename, ex)
                    raise SqlmapSystemException(errMsg)

    return kb.cache.content[filename]
def readCachedFileContent ( filename , mode = 'rb' ) : if filename not in kb . cache . content : with kb . locks . cache : if filename not in kb . cache . content : checkFile ( filename ) try : with openFile ( filename , mode ) as f : kb . cache . content [ filename ] = f . read ( ) except ( IOError , OSError , MemoryError ) , ex : errMsg = "something went wrong while trying " errMsg += "to read the content of file '%s' ('%s')" % ( filename , ex ) raise SqlmapSystemException ( errMsg ) return kb . cache . content [ filename ]