On Fri, Oct 9, 2009 at 1:57 PM, Christophe Pettus <x...@thebuild.com> wrote: > On Oct 8, 2009, at 10:41 AM, Alvaro Mouriño wrote: >> I was asked to keep track of how many times each edition >> is downloaded, but I want to make a difference between completed >> downloads and uncompleted. > > Unfortunately, this is a really messy problem, since the user can > cancel downloads, do partial downloads, etc., etc. The only way I > have found to do it is to parse the web server logs (ick).
Asking many people about this a friend told me that when he had to do this the only way was using a CGI script to serve the file. In my case I would process the request, if the user can download the file I save it in the database BUT as incomplete, then redirect to a CGI script. That script would load the file, serve it and when it finishes updates the database to unmark the download as incomplete. If it doesn't finish, the record never gets updated. That's the idea, sounds good but I haven't implemented it, I don't know the risks of this. I would not load django in the script because it would consume too much RAM, so the script would blindly update the record using raw SQL. I'm not too sure about this, but I don't see it as a big security issue. Thanks for your idea Christophe. > -- > -- Christophe Pettus > ...@thebuild.com -- AlvAro --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---