def setup_environ(self): """ Setup the environ dictionary and add the `'ws4py.socket'` key. Its associated value is the real socket underlying socket. """ SimpleHandler.setup_environ(self) self.environ['ws4py.socket'] = self.environ['wsgi.input']._sock
def setup_environ(self): """ Setup the environ dictionary and add the `'ws4py.socket'` key. Its associated value is the real socket underlying socket. """ SimpleHandler.setup_environ(self) self.environ['ws4py.socket'] = get_connection(self.environ['wsgi.input']) self.http_version = self.environ['SERVER_PROTOCOL'].rsplit('/')[-1]
def get(self, path): """ get the content of a url as rendered by bottle """ handler = SimpleHandler(sys.stdin, sys.stdout, sys.stderr, {}) handler.setup_environ() env = handler.environ env.update({ "PATH_INFO": "{0}/{1}".format(self.base_url, path), "REQUEST_METHOD": "GET", }) out = b"".join(self.app(env, lambda *args: None)) return out