def wsgi_wrap(app):
    '''
    Wraps a standard wsgi application e.g.:
        def app(environ, start_response)
    It intercepts the start_response callback and grabs the results from it
    so it can return the status, headers, and body as a tuple
    '''
    @wraps(app)
    def wrapped(environ, start_response):
        status_headers = [None, None]
        def _start_response(status, headers):
            status_headers[:] = [status, headers]
        body = app(environ, _start_response)
        ret = body, status_headers[0], status_headers[1]
        return ret
    return wrapped
def wsgi_wrap ( app ) : @ wraps ( app ) def wrapped ( environ , start_response ) : status_headers = [ None , None ] def _start_response ( status , headers ) : status_headers [ : ] = [ status , headers ] body = app ( environ , _start_response ) ret = body , status_headers [ 0 ] , status_headers [ 1 ] return ret return wrapped
Wraps a standard wsgi application e.g.:
        def app(environ, start_response)
    It intercepts the start_response callback and grabs the results from it
    so it can return the status, headers, and body as a tuple