OpenQuizz
Une application de gestion des contenus pédagogiques
ClosingIterator Class Reference
Inheritance diagram for ClosingIterator:
Collaboration diagram for ClosingIterator:

Public Member Functions

def __init__ (self, iterable, callbacks=None)
 
def __iter__ (self)
 
def __next__ (self)
 
def close (self)
 

Detailed Description

The WSGI specification requires that all middlewares and gateways
respect the `close` callback of the iterable returned by the application.
Because it is useful to add another close action to a returned iterable
and adding a custom iterable is a boring task this class can be used for
that::

    return ClosingIterator(app(environ, start_response), [cleanup_session,
                                                          cleanup_locals])

If there is just one close function it can be passed instead of the list.

A closing iterator is not needed if the application uses response objects
and finishes the processing if the response is started::

    try:
        return response(environ, start_response)
    finally:
        cleanup_session()
        cleanup_locals()

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  iterable,
  callbacks = None 
)

Member Function Documentation

◆ __iter__()

def __iter__ (   self)

◆ __next__()

def __next__ (   self)

◆ close()

def close (   self)

The documentation for this class was generated from the following file: