FileBasedBuffer is the parent class for a variety of sub-classes,
including ReadOnlyFileBasedBuffer. Since FileBasedBuffer can be used as
an app_iter return (and by extension it's sub-classes can as well) it
should probably behave more like an iterator, and the file returned from
Even if an iterator contains no more objects, calling bool() will still
return True, in the case of FileBasedBuffer this is not true until this
Without this fix, if an application calls a second WSGI application that
returns an wsgi.file_wrapper (aka ReadOnlyFileBasedBuffer) they can't
simply test to see if the application returned a valid iterator or not
by testing it's truthiness.
This is documented in bug report:
While one could argue that testing the truthiness of a return from an
WSGI application is the wrong thing to do, I would argue that an
iterator like object should not return False when tested with bool.
bool(iter()) == True after all.