def switch(self, new_context, *args, **kwargs):
        self.debug("Switching context: %s" % new_context.__name__)
        newctx = new_context(self.request, *args, **kwargs)
        newctx._parent = self
        newctx._in_type = self._in_type
        newctx._out_type = self._out_type
        return newctx
Switch context, stack up contexts and pass on request.
dataset/ETHPy150Open abourget/pyramid_socketio/pyramid_socketio/io.py/SocketIOContext.switch