[Web-SIG] Questions/suggestions on 'wsgi.file_wrapper'
jim at zope.com
Wed Dec 21 17:25:05 CET 2005
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.
2. If the file-like object passed has a close method, wouldn't
it be acceptable for the iterator returned by wsgi.file_wrapper
to close it when iteration is done?
I would slightly prefer:
"It may have a close() method, and if so, the iterable returned by
wsgi.file_wrapper must have a close() method that invokes the original
file-like object's close() method, or the iterable must close the file
when the file-like object's read method returns no data."
I prefer this because it allows a simple generator implementation of
a default wsgi.file_wrapper.
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.
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Web-SIG