Message141179
Hi,
This was test code :-/. It was not under revision control and
unfortunately, as I feared then, it turned out I had to stop
working shortly after my last message on the low-priority
project that made me report this issue .
Yet, I have a tarball of a presumably-not-so-different version
of the code and I experimented with it this afternoon. Actually,
I could not reproduce the problem I reported in msg117933. So,
basically, the idea of replacing tempfile.TemporaryFile() by
tempfile.NamedTemporaryFile() seems to really be valid, whatever
the position of the form field.
Yet I found another problem, quite reproducible that one, that
seems to have some fame on Google. Due to the way cgi.__write()
is written, contents of uploaded files with small sizes will be
stored as StringIO. Consequently, sort-of calling
fieldstorage['filenamefield'].file.name will fail. De facto,
this may actually be the error I alluded to in msg117933 - I
honestly cannot remember what I observed then: « c'est
l'âge...».
So the patch should then be one line longer: we would need
to change __write() to add a check on the value of 'filename' :
- if self.__file.tell() + len(line) > 1000:
+ if self.filename or self.__file.tell() + len(line) > 1000:
This way, long textareas (for example), keep being stored on
disk if this has any importance.
There is yet one question I cannot answer: where does the 1ko
barrier come from? Was it only chosen out of performance
considerations, or was there another reason? As I am quite new
to Python I fear I may miss something obvious.
HTH |
|
Date |
User |
Action |
Args |
2011-07-26 20:56:48 | phep | set | recipients:
+ phep, orsenthil, eric.araujo |
2011-07-26 20:56:48 | phep | set | messageid: <1311713808.12.0.227146380273.issue9968@psf.upfronthosting.co.za> |
2011-07-26 20:56:47 | phep | link | issue9968 messages |
2011-07-26 20:56:47 | phep | create | |
|