def execute_input_middleware_stream(self, request, controller):
        start_request = request
        # either 'http' or 'cmd' or 'irc'
        controller_name = "".join(controller.get_controller_name().split('-')[:1])
        middlewares = list(self.pre_input_middleware) + list(self.input_middleware)
        for m in middlewares:
            to_execute = getattr(m(controller), controller_name)
            if to_execute:
                result = to_execute(request)
                if GiottoControl in type(result).mro():
                    # a middleware class returned a control object (redirection, et al.)
                    # ignore all other middleware classes
                    return request, result
                request = result
        return start_request, request
Request comes from the controller. Returned is a request.
dataset/ETHPy150Open priestc/giotto/giotto/programs/__init__.py/Program.execute_input_middleware_stream