Phillip J. Eby wrote: > At 11:25 AM 12/21/2005 -0500, Jim Fulton wrote: > >> Here are some questions and sugesstions on the 'wsgi.file_wrapper' >> part of the WSGI API: >> >> 1. Does this need to be optional? It seems that it would be >> easy for any server to provide this, it would be nice for >> applications to be able to rely in it. > > > It's intentionally optional because its presence signifies that the > server can do things *better* than the application, if and only if the > object is a "real" operating system file or other "special" object. The > only reason the spec requires only a "file-like" object rather than an > object with a valid "fileno()" method, is because somebody wanted to > support Jython objects wrapping Java sio(?) objects, for a Java > equivalent of sendfile().
I guess I'm puzzled how the server can fail to do at least as well as the application. Can you think of a case where an application wants to output a file and can do better than a simple fallback iterator provided by the server? > >> 2. If the file-like object passed has a close method, wouldn't ... > If I understand your suggestion correctly, you're asking to change that > in a way that disallows early closing, and I don't think that should be > allowed. Ah! I see. Good point. OK, I withdraw my suggestion. ... >> 3. The server should be allowed to use the file wrapper in a different >> thread than the one used to run the application. This should be >> noted. >> Applications should not return file-like objects that rely on running >> in the same thread. This too should be noted. > > > This seems reasonable to me. For the actual use cases file_wrapper was > intended to support (sendfile() and the Java equivalent thereof) this > should be no problem at all. Cool. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org _______________________________________________ Web-SIG mailing list [email protected] Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com
