Miscellaneous Utilities

class falcon_sqla.util.ClosingStreamWrapper(stream, close)

Iterator that wraps a WSGI response iterable with support for close().

This class is used to wrap WSGI response streams to provide a side effect when the stream is closed.

If the provided response stream is file-like, i.e., it has a read attribute, that attribute is copied to the wrapped instance too.

Parameters:
  • stream (object) – Readable file-like stream object.

  • close (callable) – A callable object that is called before the stream is closed.