(self)
CherryPy has two internal flags that we are interested in
        to enable WebSocket within the server. They can't be set via
        a public API and considering I'd want to make this extension
        as compatible as possible whilst refraining in exposing more
        than should be within CherryPy, I prefer performing a bit
        of introspection to set those flags. Even by Python standards
        such introspection isn't the cleanest but it works well
        enough in this case.

        This also means that we do that only on WebSocket
        connections rather than globally and therefore we do not
        harm the rest of the HTTP server.
CherryPy has two internal flags that we are interested in
        to enable WebSocket within the server. They can't be set via
        a public API and considering I'd want to make this extension
        as compatible as possible whilst refraining in exposing more
        than should be within CherryPy, I prefer performing a bit
        of introspection to set those flags. Even by Python standards
        such introspection isn't the cleanest but it works well
        enough in this case.
CherryPy has two internal flags that we are interested in to enable WebSocket within the server . They can t be set via a public API and considering I d want to make this extension as compatible as possible whilst refraining in exposing more than should be within CherryPy I prefer performing a bit of introspection to set those flags . Even by Python standards such introspection isn t the cleanest but it works well enough in this case .
def _set_internal_flags(self):
        """
        CherryPy has two internal flags that we are interested in
        to enable WebSocket within the server. They can't be set via
        a public API and considering I'd want to make this extension
        as compatible as possible whilst refraining in exposing more
        than should be within CherryPy, I prefer performing a bit
        of introspection to set those flags. Even by Python standards
        such introspection isn't the cleanest but it works well
        enough in this case.

        This also means that we do that only on WebSocket
        connections rather than globally and therefore we do not
        harm the rest of the HTTP server.
        """
        current = inspect.currentframe()
        while True:
            if not current:
                break
            _locals = current.f_locals
            if 'self' in _locals:
               if type(_locals['self']) == HTTPRequest:
                   _locals['self'].close_connection = True
               if type(_locals['self']) == HTTPConnection:
                   _locals['self'].linger = True
                   # HTTPConnection is more inner than
                   # HTTPRequest so we can leave once
                   # we're done here
                   return
            _locals = None
            current = current.f_back
def _set_internal_flags ( self ) : current = inspect . currentframe ( ) while True : if not current : break _locals = current . f_locals if 'self' in _locals : if type ( _locals [ 'self' ] ) == HTTPRequest : _locals [ 'self' ] . close_connection = True if type ( _locals [ 'self' ] ) == HTTPConnection : _locals [ 'self' ] . linger = True # HTTPConnection is more inner than # HTTPRequest so we can leave once # we're done here return _locals = None current = current . f_back