Berker Peksag email@example.com added the comment:
Please revert 360e1e4c519cfc139de707bcdd1e6c871eec79ee. It's not a good example to put into the documentation.
It uses different naming convention. It would only confuse users relatively new to the wsgiref module and WSGI protocol.
FileWrapper was supposed to support __getitem__ and __iter__ protocols for compatibility with older Python versions, but its __getiem__ implementation is buggy and is already deprecated. It has no use case in modern Python code.
It has zero exception handling and will return a cryptic traceback if mimetype cannot detect type of the file.
The examples in the wsgiref documentation already cover most of the cases. There is no need to add more similar ones.
---------- nosy: +berker.peksag