Note that one micro-optimization for PUT requests is to not use a
FieldStorage at all because the body is never mime-encoded anyway in
I have a monkey patch to do this now, which I turned into a patch for
the core, but took out because Phillipp whined at a sprint once. ;-)
Here's the monkey patch...
""" Patch HTTPRequest.processInputs to not do any processing on a
PUT request (it's pointless, and foils our on-the-fly encryption,
as it creates a new tempfile via FieldStorage). """
# note that OTF encryption support only works for PUT requests
from ZPublisher.HTTPRequest import HTTPRequest
oldProcessInputs = HTTPRequest.processInputs
# "static" variables that we want to be local for speed
REC=12, # RECORD|RECORDS
"""Process request inputs
We need to delay input parsing so that it is done under
publisher control for error handling purposes.
if method == 'PUT':
# we don't need to do any real input processing if we
# a PUT request. This is an optimization especially
# FieldStorage creates an additional tempfile if we
allow it to
# parse the body, and PUT uploads can tend to be large.
self._file = self.stdin
HTTPRequest.processInputs = newProcessInputs
On Mar 7, 2007, at 9:57 PM, Philipp von Weitershausen wrote:
Christian Theune wrote:
[modified slightly from a similar proposal to zope3-dev to match Zope
I'm writing up a proposal for the ZODB to make even more efficient
This includes not copying the data from an uploaded file, but using a
`link` operation when possible.
I think this is a great idea.
Am I the only person here who immediately associated "link" with
the POSIX? Also, am I the only one who read "when possible" as
"when on a POSIX system where link is available", in other words,
"when not on Windows"? One starts to wonder...
However, the HTTPRequest class currently uses the default
of the cgi module's FieldStorage.
I propose to create a small subclass to override the `make_file`
to use `NamedTemporaryFile` instead of `TemporaryFile` to allow
being accessible from a filename so I can apply a `link` operation.
http://worldcookery.com -- Professional Zope documentation and
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
Zope3-dev mailing list