My application/controller is creating a zipped folder of files
specific to each use and then the user downloads the folder. I'm able
to create the zipped folders OK and set up the disk caching without
apparently any errors, and I see that the system is updating the files
in the applications cache folder. Is Web2Py cacheing the original
file? Web2Py is not removing the file and when I have the controller
delete the original file the application crashes upon download,
despite the download is supposed to be from the cached version of the
file.
What I want to do is have the system automatically remove the zipped
file after they have been downloaded.
I am trying to do this with:
the_path = 'theZipped_Files' + response.session_id + '.zip';
t = cache.disk('files_zipped', lambda: the_path , time_expire=3*60);
# import os;
# os.remove(the_path);
return response.stream(open(t,'rb'),chunk_size=4096)
The above code downloads the correct zipped files. If I un-comment the
above commented code, "empty" zipped files are downloaded.
Any advice appreciated - thanks in advance, James