This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author phep
Recipients eric.araujo, orsenthil, phep
Date 2011-07-27.19:56:50
SpamBayes Score 2.7177922e-08
Marked as misclassified No
Message-id <1311796611.63.0.750499865211.issue9968@psf.upfronthosting.co.za>
In-reply-to
Content
>> where does the 1ko barrier come from? Was it only chosen out of 
>> performance considerations [...]
> 
> Most certainly.  I’ll look at the history of the file later to try to
> find the developer who decided that.

Guido van Rossum made the changes. Before that a temporary file was created for every form field.

>> tempfile.NamedTemporaryFile was already used in python 3 (fixed in 
>> r57595, with not many explanations though).
> 
> That’s a TemporaryFile, without a name.  For more explanations, follow

Yes, my sleepy eyes and drowsy brain fooled me more than once last
night. Sigh...

> the parents of the changeset and you’ll find aee21e0c9a70 
> (referencing #1033) and cbd50ece3b61, where you can see an XXX
> note that is probably the “wish” referred to in the cryptic commit
> message.

Thanks.

A last question before trying to write the patch: In order for the change I propose to be interesting, one should let caller code decide where (on disk) the NamedTemporaryFile should be created since writing this on a different partition than the one the file will eventually reside on would ruin the whole trick. Also, I believe one can think of other reasons to give this freedom.

Unfortunately, in order to do that, I can see no other solution than to change the FieldStorage constructor signature since the temp files are created as soon as the object is instantiated. So, we would end up with something along those lines:

class FieldStorage(cgi.FieldStorage):
    def __init__(self, tempdir=tempfile.gettempdir()):
        self.tempdir = tempdir
	...

or a somewhat more convoluted form that would avoid importing tempfile needlessly.

Do you think this would be acceptable ?
History
Date User Action Args
2011-07-27 19:56:51phepsetrecipients: + phep, orsenthil, eric.araujo
2011-07-27 19:56:51phepsetmessageid: <1311796611.63.0.750499865211.issue9968@psf.upfronthosting.co.za>
2011-07-27 19:56:51pheplinkissue9968 messages
2011-07-27 19:56:50phepcreate