'Call the WSGI application object, iterate it, and handle its output.
This must be called in a non-I/O thread (ie, a WSGI application
thread).'

def run(self):

    try:
        appIterator = self.application(self.environ, self.startResponse)
        for elem in appIterator:
            if elem:
                self.write(elem)
            if self._requestFinished:
                break
        close = getattr(appIterator, 'close', None)
        if (close is not None):
            close()
    except:
        def wsgiError(started, type, value, traceback):
            err(Failure(value, type, traceback), 'WSGI    application    error')
            if started:
                self.request.loseConnection()
            else:
                self.request.setResponseCode(INTERNAL_SERVER_ERROR)
                self.request.finish()
        self.reactor.callFromThread(wsgiError, self.started, *exc_info())
    else:
        def wsgiFinish(started):
            if (not self._requestFinished):
                if (not started):
                    self._sendResponseHeaders()
                self.request.finish()
        self.reactor.callFromThread(wsgiFinish, self.started)
    self.started = True
