﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7593	Temporary uploaded file API (TemporaryFile) is inadequate	vomjom	Jacob	"The temporary file is not properly deleted much of the time for me.  There's already a known issue where if you kill/restart apache, the temporary files will stay around forever (at least until system reboot), but if you also fork a process and pass the files to it, they stick around.  I don't understand why there's a TemporaryFile class inside of uploadhandler.py when it could just use tempfile.TemporaryFile (which unlinks the file immediately after creation, rather than at garbage collection).

The other issue with the uploadhandler.TemporaryFile class is that it's not iterable (it defines __iter__ via its __getattr__, but that doesn't work), so it doesn't act like a real file object.  This is an issue if you try to use some python libraries with the uploaded file, e.g. csv.  This again would be fixed if tempfile.TemporaryFile was used.

Also, it's a bit strange that the UploadedFile API doesn't offer direct access to the file object.  It seems to me that a very common use-case for upload handling is to process the file using python's standard library.  Two examples I currently use in my program are zipfile and csv.  Both require access to the underlying file object.  It seems especially strange because the UploadedFile has a TemporaryFile object that it could return (although as I mentioned above, it is inadequate as a replacement for a file object).  When handling and processing huge uploads, it doesn't seem right to force the user to chunk the UploadedFile to a new file (which much of the time will be temporary itself) to be able to open it in a standard python libs."		closed	Uncategorized	dev		fixed		vomjom@… mike@…	Accepted	1	0	0	0	0	0
