bytes. If it reads less, it's at the end of the stream. Blocks
until the requested amount has been read.
req.read() - reads all data from the stream (bad idea), blocks until EOS.
req.read(None) - reads the next chunk of data, blocks if no data available.
Returns 0 size if at EOS.
Mike
[
http://issues.apache.org/jira/browse/MODPYTHON-93?page=comments#action_12444850
]
Mike Looijmans commented on MODPYTHON-93:
-
A very simple approach would be to delete the dictionary attribute when
any change is made.
The add_field
so that it could be publicly available.
(side thought: Allowing population from code rather than only from a Request object might allow
FieldStorage to be used in test code)
--
Mike Looijmans
Philips Natlab / Topic Automation
Graham Dumpleton (JIRA) wrote:
[ http://issues.apache.org/jira
* How are applications supposed to perform write operations on a
FieldStorage, in 3.3 and the future?
Since we claim that FieldStorage behaves like a dictionary, the obvious
syntax would be:
form['mykey'] = 'value'
This would require a __setitem__ method which should look something like
this
import sys
sys.stdout.write(open('penguin.png', 'rb').read())
NO. NO. NO.
sys.stdout is a global variable. If you want sys.stdout.write() to end
up in the user's terminal, your web server will be able to either serve
only one request at a time, or must be forced into running separate
to sys.stdout
(sys.stdout.buffer == hello2 world1)
- terminates, and sends sys.stdout.buffer to client
##Thread 2
- writes world2 to sys.stdout
(sys.stdout.buffer == hello2 world1world2)
- terminates, and sends sys.stdout.buffer to client
Mike Looijmans
Philips Natlab / Topic Automation
Fırat
for us?
--
Mike Looijmans
Philips Natlab / Topic Automation
Graham Dumpleton wrote:
With FieldStorage being discussed on main user mailing list, came across
this old post of the mailing list:
http://www.modpython.org/pipermail/mod_python/2001-November/012256.html
What it is saying
a second), this
saves me a lot of time when working on a part of a big project, where I don't need to run all tests
all the time.
--
Mike Looijmans
Philips Natlab / Topic Automation
Jim Gallacher wrote:
...
I've been playing with some ideas for a new test framework, using a
subclass
Nicolas, could you make a Win32 binary for us poor people?
--
Mike Looijmans
Philips Natlab / Topic Automation
I was checking the documentation with respect to this patch and I noticed a
couple of things.
The FieldStorage constructor has 2 undocumented parameters, file_callback=None,
field_callback=None. These were added in r160259 as part of Barry Pearce's fix
for MODPYTHON-40. In the same patch,
a dictionary for fields
- Allow any file-like object ('write' method) to be used in a make_file callback
(all the coding is already done)
Mike Looijmans
Philips Natlab / Topic Automation
it integrated?
(I really need the file upload to work decently, and others may like the
improved performance)
--
Mike Looijmans
Philips Natlab / Topic Automation
Mike Looijmans
Philips Natlab / Topic Automation
Jim Gallacher wrote:
Mike Looijmans wrote:
I'm currently using a 'private' patch, but I would really like to see
this one incorporated in some release:
http://issues.apache.org/jira/browse/MODPYTHON-93
The patch is there, all unit tests pass
Yup. Much better with that one:
##
Ran 6 tests in 91.047s
OK
##
You have my +1 (even though you weren't waiting for it)
And my merged util.py also passes the test suite, which is what I really
wanted to know.
--
Mike Looijmans
Philips Natlab / Topic Automation
Nicolas Lehuen wrote:
Yup
I get failing tests on WinXP-sp2, apache 2.0.54, python 2.4.2.
This may be because the test suite is looking for things not there yet.
Put the 3.2.8 binary distribution on my system and did a svn update to
get the latest test suite. When running the tests, I got the following
failures (can we
it
into memory (which is what we were preventing in issue 40)
A quick way to solve it is to use this code:
http://issues.apache.org/jira/browse/MODPYTHON-93
this will remove the bad checks for field types alltogether.
--
Mike Looijmans
Philips Natlab / Topic Automation
Oh and if we are refactoring the tests, I want a make tests rule. I'm
tired of doing: ./configure; make; sudo make install; make tests; DOH!
cd test; python test.py. :)
Make that make check (like autotools), to not confuse old-skool
autoconfers like myself.
[ http://issues.apache.org/jira/browse/MODPYTHON-93?page=all ]
Mike Looijmans updated MODPYTHON-93:
Attachment: modpython325_util_py_dict.patch
What it does:
- Simplifies the creation of StringField objects. This was already
marked as a TODO
.
--
Mike Looijmans
Philips Natlab / Topic Automation
a 400 response, because you MUST supply it (says RFC 2068,
and whatever superseded that one). There is more you must do to be able
to call yourself HTTP/1.1 by the way, such as keep-alive connections and
chunked encoding.
--
Mike Looijmans
Philips Natlab / Topic Automation
expectations.
How about we make the first call to get or __getitem__ create the
dictionary? We could put code in __getattr__ to create it when it's
referenced.
Patch is on its way...
--
Mike Looijmans
Philips Natlab / Topic Automation
)
--
Traceback (most recent call last):
File test.py, line 1117, in test_util_fieldstorage
self.fail(`rsp`)
File /usr/lib/python2.3/unittest.py, line 270, in fail
raise self.failureException, msg
AssertionError: ['1', '2', '3', '4']
Jim
--
Mike Looijmans
Philips Natlab / Topic Automation
don't think it's
needed.
It works:
- Perfect on all of my projects.
Attached:
- Patch created by SVN
--
Mike Looijmans
Philips Natlab / Topic Automation
Index: util.py
===
--- util.py (revision 348746)
+++ util.py (working copy
), but I do most development on this Windows system, so I need a
windows executable anyway.
PS: Haven't found any speling errors in your document...
Jim Gallacher wrote:
Mike Looijmans wrote:
Inspired by our FieldStorage work with file uploads, I also made some
implementation changes to Field
- since i won't be hackin' the C code (yet), would it be
sufficient to just install the binary, and use the .py files as obtained
from the SVN repository?
The 3.2.5 beta seems to run just fine here. Cannot run the automated
tests though, because of the issues mentioned above.
--
Mike Looijmans
) and the 'mike'
version.
In addition, I added some profiling calls to show the impact of the
extra 'endswith' and slices.
--
Mike Looijmans
Philips Natlab / Topic Automation
#!/usr/bin/env python
import sys
from cStringIO import StringIO
import md5
##def generate_split_file(offset=-1
'
else:
file.write(previous_delimiter + line)
previous_delimiter = ''
This new functions passes the test for Jim's filetest generator.
--
Mike Looijmans
Philips Natlab / Topic Automation
27 matches
Mail list logo