@locked_function
def store_in_cache(cache_location, url, response):
 (hpath, bpath) = calculate_cache_path(cache_location, url)
 try:
  outf = open(hpath, 'wb')
  headers = str(response.info())
  outf.write(headers)
  outf.close()
  outf = open(bpath, 'wb')
  outf.write(response.read())
  outf.close()
 except IOError:
  return True
 else:
  return False

@ locked_function def store_in_cache ( cache_location , url , response ) : ( hpath , bpath ) = calculate_cache_path ( cache_location , url ) try : outf = open ( hpath , 'wb' ) headers = str ( response . info ( ) ) outf . write ( headers ) outf . close ( ) outf = open ( bpath , 'wb' ) outf . write ( response . read ( ) ) outf . close ( ) except IOError : return True else : return False
tries to store response in cache .