Maybe the files are being removed before sending the data to the
client?

You could use a background task with the cron (web2py manual 4.18.1)
feature for removing old files after a given time.

On Feb 21, 4:25 pm, "james c." <[email protected]> wrote:
> 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

Reply via email to