2 cents on file objects... WAS: RE: [Web-SIG] Bill's comments on
WSGI draft 1.4
Michael C. Neel
neel at mediapulse.com
Thu Sep 2 15:19:27 CEST 2004
Well, I've seen alot of back and forth on file objects, write(), etc. I
think it's of little issue myself, not that hard to return an interface
that will support both methods. Let the programming working on the
middlware/application decide against the tradeoffs from one method to
another.
In the framework I use, I've actually altered it to allow it's context
object (which is connected to the output stream, among other things) to
be used as a file object. The first need for this was to allow me to
pass the object off to a cvs.writer object, when I then called with the
result of a DB-API 2.0 fetchall(); and made a "Download as CSV" button
work in no more than 4 lines of code. I could also see doing this with
XML classes for a WSDL/SOAP system. Really off the wall, you could do
this with the logging module, and send your logging statments to another
server.
I suppose with any of these I could grab the StringIO module and add a
few extra lines to my code. Then again, a WSGI system could also do
that in it's implementation and ever offer me the options of buffered or
non-buffered output.
As it's been said here before, adoption of the frameworks and server is
going to be critical to WSGI. So I'd opt for more choice and
flexibility; we're all smart guys here and I don't think we would turn
down a good idea because of complexity.
Mike
More information about the Web-SIG
mailing list