[Web-SIG] wsgi.errors and close method
graham.dumpleton at gmail.com
Tue Mar 30 11:06:03 CEST 2010
On 30 March 2010 19:27, Manlio Perillo <manlio_perillo at libero.it> wrote:
> Manlio Perillo ha scritto:
>> Some time ago, someone reported me that an application embedded in Nginx
>> with my WSGI module failed to execute, since in my implementation the
>> wsgi.errors object does not implement the .close method.
>> Any idea?
> Here is the culprit:
> So it seems safe, when the Log object used in wsgi.errors is also used
> to replace sys.stderr, to just add the closed attribute (but *not* the
> close method).
It is all very silly. Technically a file like object is not required
to have a 'closed' attribute, so that code expecting it was wrong in
the first place.
The close() method is however required of file like objects so if you
are going to replace a file like object, you should have it.
All you can really do is supply as many of the methods, attributes as
possible, all required and as many as optional as makes sense, because
you can't trust people to read the documentation properly.
More information about the Web-SIG